Created
February 10, 2009 04:57
-
-
Save ap/61242 to your computer and use it in GitHub Desktop.
Answers to Tom Duff's stylistic conundrums presented in “Reading Code From Top to Bottom”, http://www.iq0.com/notes/deep.nesting.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* answers to Tom Duff's stylistic conundrums presented in | |
[Reading Code From Top to Bottom] | |
(http://www.iq0.com/notes/deep.nesting.html) | |
*/ | |
char *skip(char *s, int c) { | |
char cc; | |
for(;;) { | |
if(!*s) break; | |
cc = *s++; | |
if(cc==c) break; | |
} | |
return s; | |
} | |
/* * * * * * * * * * * * * * * * * */ | |
char *stopword = "/*%"; | |
char *cursor = stopword; | |
while(*cursor){ | |
c=getc(f); | |
if(c==EOF) { /* handle error */ } | |
if(c!=*cursor) cursor=stopword; | |
if(c==*cursor) ++cursor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment