Quote:
|
Originally Posted by Astronouth7303
I know that, but generally isn't "If (foo=42)" what one tries to avoid?
|
I think you missed the point.
The reason C compilers don't typically give warnings or errors for using the single equals sign inside a conditional is because it CAN be valid. In the code I posted, the single equals sign sets the address of a file handle, whose value needs to be inequal to zero in order to work. Yes, it's one of those annoying tricks used by programmers who like being clever (i.e. me), but my point is that it's valid and there's no reason the compiler should label it as a syntax error.