B
Beej Jorgensen
Ahh, but whether or not you asked about it, you should be aware that
doing stuff like that will make any future reader familiar with C
assume that your code is unreliable.
This is an absolutely valid warning, regardless of the actual
reliability of the code.
Why don't you go a bit further and write:
TRUE = (((1!=0)!=(1!=1))!=0)
Because, as I'm guessing you'd agree, (1==0) is clearly "false", while
(((1!=0)!=(1!=1))!=0) is clearly "insane".
If you are 100% sure that (1==0) is 0, just write 0.
All in the name of clarity, I say. If you found a situation where
saying (1==0) would clarify the code or improve its readability, I'll
bet you'd write it. I don't think the OP is in one of those situations,
though--"FALSE=0" has pretty unambiguous meaning.
But I've written things like "<<0" in code before where I thought it
improved clarity for future maintainers. Or I've left in unsimplified
constant arithmetic expressions where it would help explain the thinking
behind it.
And while I personally wouldn't define FALSE as (1==0) in my code, I
don't think it's nearly as dire a monstrosity as (((1!=0)!=(1!=1))!=0),
nor is it as bad as horribly misplaced squirrely braces at column 97 or
whatever.
But the OP should define FALSE as 0 for some or all of these reasons:
1) C clearly defines it that way
2) All C coders know it
3) Defining it as (1==0) doesn't particularly improve clarity
4) People might harshly judge his code
That really should be enough--it doesn't have to get into a weird
subjective style fight with extreme fabricated coding examples.
-Beej