[cfe-dev] Question about use of bool in asan_interface.h
David Chisnall
David.Chisnall at cl.cam.ac.uk
Fri Apr 11 01:35:56 PDT 2014
On 11 Apr 2014, at 06:56, Filip Pizlo <fpizlo at apple.com> wrote:
> And #include <stdbool.h> doesn't work?
>
> Most pre-C99 environments had that header.
You need stdbool.h to use bool with C99 - the keyword is called _Bool (unlike C++, C doesn't reuse valid identifiers as keywords in new versions. Unfortunately, it also doesn't provide a single c99.h / c11.h for turning all of the new keywords into their non-ugly versions, but I digress).
The FreeBSD stdbool.h, an old version of which ships with OS X, defines _Bool to int in stdbool.h for C89, but this is non-standard behaviour. GNU libc, for example, does not do this.
Including stdbool.h in asan_interface.h would fix the issue for C99, but not for C89 (in a portable way).
David
More information about the cfe-dev
mailing list