5 ms·
Regarding hidden in plain sight, would a semicolon at the end of the if statement throw a warning? Would be a little more hidden.
by Varcht 13y ago
Regarding hidden in plain sight, would a semicolon at the end of the if statement throw a warning? Would be a little more hidden.
- huhtenberg 13y agoYeah, that'd trigger a warning in most compilers - "Empty statement found. Was it an intent?" or something similar.
- valleyer 13y agoNot true, try for (;;) ; in gcc / clang
- SimHacker 13y agoThat's because "for (;;) ;" is and idiom that's commonly used in a programming pattern called the "for(;;);ce field", to work around other C and C preprocessor quirks, by syntactically insulating and protecting statements in C preprocessor macros from outside interference. As a matter of fact, by deploying one of those the beginning of the macro, one in the middle, and one at the end, you can set up what's called a "trifor(;;);ce field", an anti-anti-pattern that is documented on the c2 wiki thusly: The trifor(;;);ce has the power to grant the wish of whomever touches it, and molds the Sacred Realm to reflect that person's heart. The trifor(;;);ce does not discriminate between "good" or "evil". However, if a person without an equal balance of power, wisdom, and courage makes a wish, the trifor(;;);ce will split into its three separate parts: the piece that best personifies the wish-maker will be the only piece to remain in hand, whilst the other two will take residence in whosoever most personifies them. Reassembly is then required for such a person's wish to be granted, but does not exclude another from making the attempt. No, I'm just joking and making shit up. Don't anyone ever do that! As bitchy and pedantic as gcc and clang are about other things, I'm disappointed they don't complain about that.