3 ms·
from page... zOMG this is evil! CODE THAT MASQUERADES AS COMMENTS AND VICE VERSA Include sections of code that is commented out but at first glance does not a
by bcRIPster 13y ago
from page... zOMG this is evil!
CODE THAT MASQUERADES AS COMMENTS AND VICE VERSA
Include sections of code that is commented out but at first glance does not appear to be.
for ( j=0; j < array_len; j +=8 )
{
total += array[j+0];
total += array[j+1];
total += array[j+2]; /* Main body of
total += array[j+3]; * loop is unrolled
total += array[j+4]; * for greater speed.
total += array[j+5]; */
total += array[j+6];
total += array[j+7];
}
Without careful attention , would you notice that three lines of code are commented out?
- EpicEng 13y agoI would, unless perhaps I were reading it in notepad. Thank god for syntax highlighting.
- TrainedMonkey 13y agoOr you could just use virtually any IDE with comment highlighting. Quite a few of patterns mentioned are either mitigated or defeated by good IDE.
- zalew 13y agoif by IDE you mean an editor, you don't need an IDE to have syntax highlighting.
- pubby 13y agoTrigraphs make it more evil: // will the next line be compiled??/ no it won't!
- danudey 13y agoEven better: make the non-executed line of code break things in subtle ways if compiled without -trigraphs.
- prawks 13y agoI did, but only because I said to myself "Who in the hell writes a block comment there? Can you even do tha- Oh." Not sure if that counts as careful attention, but it's usually clear something could be wrong when someone writes something in a very odd way.