[Ilugc] [Technical] Does 'C' language specification has 'boolean' datatype ?
- From: thescriptdevil@xxxxxxxxx (Ashok Gautham)
- Date: Sat, 17 Dec 2011 15:05:17 +0530
On Sat, Dec 17, 2011 at 02:22:26PM +0530, 0 wrote:
It was just a simple code snippet to indicate bool can be quickly added.
I agree, it should not be used exactly as mentioned since the naming is
too generic. OP can chose whether to use stdbool.h or add 3 lines to his
code, to me this is just a moot point.
No. It is very important to stick to the standard. In C's rationale,
existing code is extremely important while existing implementations
are not. [1]. Therefore, #defines like this still work and probably
will work for eternity.
But standards are established for a reason. They define the interface
or guarantees that are offered by the language. A language MyBreakyC
may choose to define 1 to be true and 0 false in one implementation
and the other way around in another. The programmer is expected to use
names like true and false to stay safe.
---
Ashok Gautham
[1] www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf
Page 9, Line 20
Other related posts: