A couple of entries from the Codex Vomitus
-
/***** Stuff that Windows did wrong *****/
#ifdef ERROR
#undef ERROR
#endif
#define ERROR (-1)
#define OK (0)/***** Generic Stuff not in Windows *****/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endifThis is in a body of 'C' code I'm stuck with maintaining. This crap was originally written by a Sun UNIX jock who was a zero-order asshat.
Software Zen:
delete this;
-
/***** Stuff that Windows did wrong *****/
#ifdef ERROR
#undef ERROR
#endif
#define ERROR (-1)
#define OK (0)/***** Generic Stuff not in Windows *****/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endifThis is in a body of 'C' code I'm stuck with maintaining. This crap was originally written by a Sun UNIX jock who was a zero-order asshat.
Software Zen:
delete this;
-
Yep, I've got over 100 source files chock-full of this kind of stuff. The average identifier length is about 5 characters, and eeeeeverything's global, sports fans! I'd like to kill the mother:elephant:er who wrote it.
Software Zen:
delete this;
-
Yep, I've got over 100 source files chock-full of this kind of stuff. The average identifier length is about 5 characters, and eeeeeverything's global, sports fans! I'd like to kill the mother:elephant:er who wrote it.
Software Zen:
delete this;
Gary Wheeler wrote:
I'd like to kill the mother[mastadon] er who wrote it.
Sounds like you and Marc Clifton need to form a posse and clean house.
-
Gary Wheeler wrote:
I'd like to kill the mother[mastadon] er who wrote it.
Sounds like you and Marc Clifton need to form a posse and clean house.
-
Great movie, one of my favorites actually! You guys were awesome! Very funny.
-
Yep, I've got over 100 source files chock-full of this kind of stuff. The average identifier length is about 5 characters, and eeeeeverything's global, sports fans! I'd like to kill the mother:elephant:er who wrote it.
Software Zen:
delete this;
I had to deal with some code like that. I compiled all of the global variables into one list and there were over 800 of them. To make matters worse, some functions had local variables of the same name in the same module. Single-letter, global variables were the ones that really, really annoyed me. It gets worse but I'll stop there.
-
/***** Stuff that Windows did wrong *****/
#ifdef ERROR
#undef ERROR
#endif
#define ERROR (-1)
#define OK (0)/***** Generic Stuff not in Windows *****/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endifThis is in a body of 'C' code I'm stuck with maintaining. This crap was originally written by a Sun UNIX jock who was a zero-order asshat.
Software Zen:
delete this;
I have seen
#define TRUE (1==1)
Which is kinda OK But in the same code there was
#define TRUE (2+2==4)
#define FALSE (2+2=5)Which just goes to show testing wasn't his strong suit.
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
/***** Stuff that Windows did wrong *****/
#ifdef ERROR
#undef ERROR
#endif
#define ERROR (-1)
#define OK (0)/***** Generic Stuff not in Windows *****/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endifThis is in a body of 'C' code I'm stuck with maintaining. This crap was originally written by a Sun UNIX jock who was a zero-order asshat.
Software Zen:
delete this;
Asumming this is actually compiled using the Visual C++ compiler I think I get boolean and NULL stuff, but what's the ERROR definition for in Windows - does this break the #error directive or something crazy like that?
-
Asumming this is actually compiled using the Visual C++ compiler I think I get boolean and NULL stuff, but what's the ERROR definition for in Windows - does this break the #error directive or something crazy like that?
This is compiled using the C++ compiler from the Windows SDK. The O(0) moron refused to use Visual Studio. The whole fetid mess is glued together using a make file and a page of command line operations.
Dar Brett wrote:
I think I get boolean and NULL stuff
TRUE
andFALSE
have been inwindows.h
for eons, as well as their 'type'BOOL
, which O(0) didn't use. He usedint
's. The code also assumes in a lot of places thatFALSE == 0
andTRUE == 1
by using the actual constants rather than the#define
's.Dar Brett wrote:
ERROR definition for in Windows - does this break the #error directive
Windows defines
ERROR
as 0. It doesn't break#error
, which is a compiler directive. It does break understanding return values from certain Windows API functions, mainly GDI. Fortunately this app is more or less a service, and there was no UI involved.Software Zen:
delete this;
-
This is compiled using the C++ compiler from the Windows SDK. The O(0) moron refused to use Visual Studio. The whole fetid mess is glued together using a make file and a page of command line operations.
Dar Brett wrote:
I think I get boolean and NULL stuff
TRUE
andFALSE
have been inwindows.h
for eons, as well as their 'type'BOOL
, which O(0) didn't use. He usedint
's. The code also assumes in a lot of places thatFALSE == 0
andTRUE == 1
by using the actual constants rather than the#define
's.Dar Brett wrote:
ERROR definition for in Windows - does this break the #error directive
Windows defines
ERROR
as 0. It doesn't break#error
, which is a compiler directive. It does break understanding return values from certain Windows API functions, mainly GDI. Fortunately this app is more or less a service, and there was no UI involved.Software Zen:
delete this;
Gotcha, I wasn't far off with the BOOL stuff. Not that I'd change it, but isn't it weird that
ERROR == ERROR_SUCCESS
? -
Gotcha, I wasn't far off with the BOOL stuff. Not that I'd change it, but isn't it weird that
ERROR == ERROR_SUCCESS
?The
ERROR
value was used as a return from some GDI functions.ERROR_SUCCESS
is a far more general Windows API return value.Software Zen:
delete this;
-
/***** Stuff that Windows did wrong *****/
#ifdef ERROR
#undef ERROR
#endif
#define ERROR (-1)
#define OK (0)/***** Generic Stuff not in Windows *****/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endifThis is in a body of 'C' code I'm stuck with maintaining. This crap was originally written by a Sun UNIX jock who was a zero-order asshat.
Software Zen:
delete this;
Gary Wheeler wrote:
zero-order asshat
That is probably the best quote I've seen in awhile :-D
-
Gary Wheeler wrote:
zero-order asshat
That is probably the best quote I've seen in awhile :-D
:bows: Thank you, thank you! I'm here all week. Try the veal, it's to die for!
Software Zen:
delete this;
-
:bows: Thank you, thank you! I'm here all week. Try the veal, it's to die for!
Software Zen:
delete this;
Gary Wheeler wrote:
Try the veal, it's to die for!
Is it ... veally good? :-D
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Gary Wheeler wrote:
Try the veal, it's to die for!
Is it ... veally good? :-D
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I think it meats and exceeds people's expectations.
Josh Davis
This is what plays in my head when I finish projects. -
I have seen
#define TRUE (1==1)
Which is kinda OK But in the same code there was
#define TRUE (2+2==4)
#define FALSE (2+2=5)Which just goes to show testing wasn't his strong suit.
Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
This is compiled using the C++ compiler from the Windows SDK. The O(0) moron refused to use Visual Studio. The whole fetid mess is glued together using a make file and a page of command line operations.
Dar Brett wrote:
I think I get boolean and NULL stuff
TRUE
andFALSE
have been inwindows.h
for eons, as well as their 'type'BOOL
, which O(0) didn't use. He usedint
's. The code also assumes in a lot of places thatFALSE == 0
andTRUE == 1
by using the actual constants rather than the#define
's.Dar Brett wrote:
ERROR definition for in Windows - does this break the #error directive
Windows defines
ERROR
as 0. It doesn't break#error
, which is a compiler directive. It does break understanding return values from certain Windows API functions, mainly GDI. Fortunately this app is more or less a service, and there was no UI involved.Software Zen:
delete this;
Quote:
The O(0) moron refused to use Visual Studio.
Sounds similar to a guy at a company that I used to work for. He did use Visual Studio, but he was "too good" to use the debugger, preferring to output values to a file to do testing. He also liked to keep his variable names <= 3 letters long to "save time". X|
Just because the code works, it doesn't mean that it is good code.