How to enable bool type keyword in .c file

PC-lint Plus User Discussion
Post Reply
How to enable bool t

How to enable bool type keyword in .c file

Post by How to enable bool t »

I would like to use the type "bool" in C, but it is not recognized because it does not exist in standard C and comes from C++. I cannot use the .cpp extension instead to get "bool" because C++ does not allow conversion of void pointer to other pointers like C and it gives errors. I tried putting "typedef signed short bool;" in a header file and using the -header option to include it in every module, but messages then say "type 'bool' (aka 'short')" instead of just "type 'bool'". Is there an alternative way to just enable the C++ bool keyword in C?
Tam

Re: How to enable bool type keyword in .c file

Post by Tam »

Have you tried using:

Code: Select all

+rw(bool)
Guest

Re: How to enable bool type keyword in .c file

Post by Guest »

It does exist in C, via a library:

Code: Select all

#include <stdbool.h>
See also: https://en.cppreference.com/w/c/types/boolean
Post Reply