pos += screamnext[pos] /* does this goof up anywhere? */
About this quote
- What does it mean?
- The code advances a position pointer using a lookup table, with a comment questioning possible errors.
- In plain terms
- It moves forward in the string, wondering if it could break.
- What can you take from it?
- Check boundary conditions when using lookup tables for indexing.
Where it applies
Putting it to work
Questions to consider
- Where could this indexing fail?
- How to verify correctness?
Another view
The comment admits uncertainty, indicating potential hidden bugs.
More from Larry Wall
str->str_pok |= SP_FBM; /* deep magic */ s = (unsigned char*)(str->str_ptr); /* deeper magic */
Permalink to quote #246 echo 'Hmmm...you don't have Berkeley networking in libc.a...' echo 'but the Wollongong group seems to have hacked it in.
Permalink to quote #248 /* And you'll never guess what the dog had */ /* in its mouth... */
Permalink to quote #241
Related quotes
str->str_pok |= SP_FBM; /* deep magic */ s = (unsigned char*)(str->str_ptr); /* deeper magic */
Larry WallLarry Wall quote #246 /* This bit of chicanery makes a unary function followed by a parenthesis into a function with one argument, highest precedence. */
Larry WallLarry Wall quote #264 Beware of bugs in the above code; I have only proved it correct, not tried it.
Donald KnuthDonald Knuth quote #2