My ASSERT is better than your ASSERT!
-
Found in some code:
<font size="2" face="Arial">#define ASSERT(x) if (!x) { printf("Dipshit! <%s:%d>\n", __FILE__, __LINE__); exit(0); }</font>
EDIT: I guess I can elaborate a little bit... this code is used on millions of consumer level devices for satellite TV.
-
Does printf go to the scren in this case, or does the box just shut down? don't see a huge problem if the user doesnt *see* the word "dipshit".
-
Shame that it's presumably only ever going to be dumped to some unconnected serial debug port, and won't actually appear simultaneously on every single end-user's screen in flashing bold red ninetysix-point font when something goes wrong at the cableco's end...
-
I like that idea :D
So, if no user sees "Dipshit":
Huge, flashing, red font on every customer's screen:
-
That is the direct result of an angry and frustrated coder chasing a bug for 17 hours straight.
-
ASSERT(0 || 1)
-
ASSERT(FILE_NOT_FOUND);
-
@robelsner said:
Found in some code:
<font face="Arial" size="2">#define ASSERT(x) if (!x) { printf("Dipshit! <%s:%d>\n", __FILE__, __LINE__); exit(0); }</font>
EDIT: I guess I can elaborate a little bit... this code is used on millions of consumer level devices for satellite TV.
That might be too specific. I can only think of one situation where this would be true: Echostar based boxes (can't remember the name of the OS on those things... ARGH!), since the same OS has been used for over a decade across so many different devices. And it is supremely WTFy. Not DirecTV based boxes, I'm guessing, since unless something's changed a lot, each manufacturer uses their own OS and it may not even cross devices from the same company.
I doubt it's in an FTA box, since those would more likely say идиот or something else foreign. ;-)
-
@shepd said:
That might be too specific. I can only think of one situation where this would be true: Echostar based boxes (can't remember the name of the OS on those things... ARGH!), since the same OS has
-
It could quite happily be in British Sky boxes. They don't change much I don't think (new fancier ones come out, but older ones are still in use)
-
Love your graphics. Nice work!
@CrazyBomber said:
I like that idea :D
So, if no user sees "Dipshit":
Huge, flashing, red font on every customer's screen:
-
@fluffy777 said:
ASSERT(0 || 1)
I'm surprised no one else has noticed this yet. In this case, the macro expands to
if (!0 || 1) { printf(....
which doesn't have the intended effect...
-
Finally... You get a bigger e-penis for figuring out the RealWTF. The fact that if you don't enclose your macro for checking, the ! operator is added to the first portion only.
ASSERT(x==y) -> if (!x == y)
or a lot of code (and what I do)
ASSERT(0 == someArgument);
in this case becomes !0 == someArgument
-
Er, that's what I get for posting when tired... that wasn't quite the right example, it does need to be a two condition check (which can be a wtf I suppose).