Best ad ever, can you spot the problem??? Some people and their bad habits, i hate stupid stuff like this.
Best ad ever, can you spot the problem??? Some people and their bad habits, i hate stupid stuff like this.
It uses goto?
To code is divine
suck.it.up won't do anything.
Also...not sure what language it's written in, but I'm guessing C++, so the "end" is pointless.
And, it's not using goto, it's assigning goto a value. Which, if it IS C or C++, then it's not a valid statement...
I don't see anything wrong with goto, as long as it is used appropriately:Originally Posted by 7smurfs
(I do see some potential evil in needless use of macros, however.)Code:#include <stdio.h> #define goto i #define end } int main() { int goto; for (goto = 1; goto <= 5; goto++) { printf("goto = %d\n", goto); } goto = 0; return goto; end
Regards,
Dave
Originally Posted by RoDRegards,Code:#include <stdio.h> #define goto i #define end } #define up hi() typedef struct _h_struct { void (*hi)(void); } h_struct; typedef struct _s_struct { h_struct it; } s_struct; int main() { void hello(void); int goto; s_struct suck; suck.it.hi = hello; for (goto = 1; goto <= 5; goto++) { printf("goto = %d\n", goto); } printf("\ngoto goto goto goto goto goto goto goto goto goto goto goto \n\n"); printf("There! Did you get it out of your system yet?\n"); suck.it.up; goto = 0; return goto; end void hello() { printf("\nHey! Are you talkin' to me?\n"); }
Dave
Well, in my post (compile it on your favorite C or C++ compiler), suck.it.up prints out a message. And if I left out the "end", it wouldn't compile. And since the preprocessor changed the "goto" to something legal, C or C++ compilers never see the badness.Originally Posted by jverkoey
If certain macros are defined in certain ways, everything in that ad compiles and executes deterministically on all C and C++ compilers that I have tested today (all four).
Now, ask me again why I hate unecessary and needless macros. (I also hate redundancy and needless repetition.)
Regards,
Dave
p.s. With the right macro, I can get void main() through g++ with no warnings and no errors even though all warning flags are set. This is for professionals only (professional idiots, that is --- like me); don't try it at home (or on cprogramming.com).
Last edited by Dave Evans; 03-13-2005 at 06:12 PM.
thank god anon its not just me
The code uses Braces where none are required but thats just personal taste.
>>The code uses Braces where none are required but thats just personal taste.
Some people dont get it
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.