Thread: Obfuscated Code
View Single Post
Old 2nd April 2009
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

if you want to use the ?: trinary/ternary operator to obfuscate things, be sure to nest them in strange and deranged ways, and slip in comma's and garbage values anywhere you can.


In my personal opinion, good code should be fairly obvious even without comments, and the comments should be free to provide 'commentary' and annotations instead of explaining away physical laziness. e.g.

Code:
/* push element onto int stack */ istk_t istkp(iskt_t *s, iskt_t *e);  

vs 

istack_t istack_push( istack_t *stk, istack_t *elem);
where the latter speaks for itself, documenting all but the 'i' part. And a proper comment in the istack module might explain what the heck the it is, and hopefully it's purpose and use should be known in a few minutes of code browsing even without it. You could say, I hate anything that I need to read more any furhter then the header file in order to use it....



Those bastardo 2000+ line procedures some people write on the other hand, just need to be drawn and quartered ;-)
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote