Cool macro tricks

Started by
73 comments, last by Mulligan 20 years, 7 months ago
You guys should check out some IOCCC entries
http://www.de.ioccc.org/years.html

(IOCCC = International Obfuscated C Code Contest)
Advertisement
Now THAT is what you should be using Macros for .
quote:Using someone else''s idea and copy pasting his source without understanding what''s written are different things


Heh, I had a friend in my HS Comp Sci class who frowned upon my use of OpenGL (when everyone else in the class made a textbased final project....). Then one day, my teacher finally shut him up by informing him that in *HIS* program, he was using the C++ compiler and that he didn''t write it, so he was "stealing" code to the same degree I was by using OGL.

And to all those who say that macros are dangerous, all I have to say is this.....

If you want a nice safe playground programming language, use Java. Even in its new "safe macro" inline functions, C++ will still let you do fun things like this:

char array[256];for (int i = 0; i <= 256; i++){        array = 0;} 



So how unsafe for loops are?


/¯\_/¯\_/¯\_/¯\_/¯\_/¯\
"You TK''ed my chicken!"
\_/¯\_/¯\_/¯\_/¯\_/¯\_/
quote:Original post by Tac-Tics
quote:Using someone else''s idea and copy pasting his source without understanding what''s written are different things


Heh, I had a friend in my HS Comp Sci class who frowned upon my use of OpenGL (when everyone else in the class made a textbased final project....). Then one day, my teacher finally shut him up by informing him that in *HIS* program, he was using the C++ compiler and that he didn''t write it, so he was "stealing" code to the same degree I was by using OGL.

And to all those who say that macros are dangerous, all I have to say is this.....

If you want a nice safe playground programming language, use Java. Even in its new "safe macro" inline functions, C++ will still let you do fun things like this:

char array[256];for (int i = 0; i <= 256; i++){        array = 0;}  



So how unsafe for loops are?


/¯\_/¯\_/¯\_/¯\_/¯\_/¯\
"You TK''ed my chicken!"
\_/¯\_/¯\_/¯\_/¯\_/¯\_/

Wot''s that got to do with macros, sucka?
stop flaming each other and post COOL MACRO TRICKS instead

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]
[ ThumbView: Adds thumbnail support for DDS, PCX, TGA and 16 other imagetypes for Windows XP Explorer. ] [ Chocolate peanuts: Brazilian recipe for home made chocolate covered peanuts. Pure coding pleasure. ]

This topic is closed to new replies.

Advertisement