3 ms·
I mean, as the sibling notes, there's redefining true as false, but I think making all structs unions is much funnier, especially in that it's a uniquely C prop
by stormbrew 10y ago
I mean, as the sibling notes, there's redefining true as false, but I think making all structs unions is much funnier, especially in that it's a uniquely C proposition. There are other languages that allow redefinition of true and false.
Also, I'm not sure how you think it's particularly obvious (as opposed to any other #define trick). It does only work if the project isn't warning-safe, as there are various ways this'll trigger ugly warnings (eg. using designated initializer syntax causes re-initialization warnings), but even then the warnings don't tend to actually tell you it's a union all of a sudden.
If you have others, I'd like to hear them.
- qwertyuiop924 10y ago#define if while #define else while(!true){} That should be interesting.
- raverbashing 10y ago- Change the alignment of structs - Remember the order of includes change how they are applied. Have a #define that changes something in a .h that's included in some files but not in others - (Depending on the software) redefine rand() to be almost predictable or with a short loop