(j3.2006) (j3-members.2006) true and false in C
Mon Oct 6 22:24:42 EDT 2014
Noted. I agree it's better to change true to 1 and false to 0 than to state
explicitly that true and false are from <stdbool.h>.
From: Robert Corbett
Date: ?? 26?10?5? 18:18
To: j3-members at j3-fortran.org
Subject: (j3-members.2006) true and false in C
I recently discussed paper 14-220 with a member of Oracle's C++ team. He
pointed out that the identifiers "true" and "false" used in Paragraph 2 of
subclause 15.2.2 [441:26] do not have fixed meanings in C99 or C11. The
identifier "_Bool" is a keyword, and so it has a fixed meaning. The identifiers
"true" and "false" are reserved identifiers but not keywords. They can have
different meanings in different contexts. The C standard requires <stdbool.h>
to define "true" to be a macro "which expands to the integer constant 1" and
"false" to be a macro "which expands to the integer constant 0." A possible
edit is to replace (_Bool)true with (_Bool)1 and (_Bool)false with (_Bool)0.
j3-members mailing list
j3-members at mailman.j3-fortran.org
This e-mail has been scanned for all viruses by Star.
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3