View Full Version : Some people dont get it
Best ad ever, can you spot the problem??? Some people and their bad habits, i hate stupid stuff like this.
7smurfs
03-13-2005, 04:36 PM
It uses goto?
jverkoey
03-13-2005, 04:52 PM
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...
Dave Evans
03-13-2005, 04:53 PM
It uses goto?
I don't see anything wrong with goto, as long as it is used appropriately:
#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
(I do see some potential evil in needless use of macros, however.)
Regards,
Dave
I was focused mainly on GOTO
Dave Evans
03-13-2005, 05:10 PM
I was focused mainly on GOTO
#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");
}
Regards,
Dave
anonytmouse
03-13-2005, 05:24 PM
The Daily WTF: Looking to the Tech Leader (http://thedailywtf.com/ShowPost.aspx?PostID=26536)
Dave Evans
03-13-2005, 05:45 PM
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...
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.
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).
thank god anon its not just me
Quantum1024
03-13-2005, 09:28 PM
The code uses Braces where none are required but thats just personal taste.
Hunter2
03-13-2005, 09:56 PM
>>The code uses Braces where none are required but thats just personal taste.
Some people dont get it:rolleyes:
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.