On Tue, Oct 30, 2007 at 05:46:08PM +0100, Richard Knutsson wrote:Yes, and it has been "corrected" in the C99-standard (which we are using since the Linux support for the the 2.95 compiler stopped). Is there something wrong in actually typing the variable to the type we want it to be? Or would it be better to regress (becoming like Perl or PHP)[1][2]?
I just don't see the reason why expressing a boolean as an integer. Some advantage?
This is C, not Java, or some other highly-typed language.
if (int) and if (ptr) are perfectly acceptable in C.
There is some places where things like 'if (var == true)' is done, but what happens when var is not the same number as 'true' (and still != 0)? It is a potential bug if 'var' is an integer and expected to be a boolean in this case. Like in a case of "var = some_var & some_flag;"(also helps us if someone does: 'if (var == true)', even thou we should try to avoid them)
I have no idea what you mean.