I came across some code written in C that looks like this:
if (file == NULL)
TRUE; /* <-- What does that mean? */
I think that it is another way of saying:
if (file == NULL);
But am I missing something, and is there a reason to do it the first way as opposed to the second way?
UPDATE:
Doing some digging, TRUE is defined as such:
#define TRUE !0
Just a guess – I suspect at some point in history someone wanted to set a breakpoint on that TRUE line.
I’ve worked with debuggers where doing that might have been easier than trying to set a conditional breakpoint. But it’s been a long, long time since that might have been true. I still find myself doing something similar in some environments if the condition I want to break on involves a function call or if a conditional breakpoint slows things down too much (that happens a lot on embedded targets where evaluation the condition in the debugger involves a lot of communication over the JTAG link).
However, that do-nothing code shouldn’t have made it into version control.