stdint.h versus stdbool.h

cancel
Showing results for 
Search instead for 
Did you mean: 

stdint.h versus stdbool.h

234 Views
briancavanagh
Contributor III

Hi, I'm using KDS 3.2.0, PE Micro, and FRDM-K22F. 

I'm not clear when stdint.h is used or stdbool.h should be used.  I'm assuming Processor Expert added the stdint.h file to my program, but I was thinking stdbool.h would have been used.  stdint.h works, I have not problem, but I wondering when is the appropriate time when stdbool.h should be used.

Thanks,

Brian

Labels (1)
0 Kudos
1 Reply

101 Views
BlackNight
NXP Employee
NXP Employee

The Processor Expert types are in PE_Types.h. There you can see that it includes <stdint.h>.

It does not include <stdbool.h> there which can lead to problems with conflicting bool types.

The thing is that 'bool' needs to be included before PE_Types.h, otherwise you get conflicts.

What I usually do is to include stdbool.h before each compilation unit. In KDS I'm using the -include compiler option:

pastedImage_1.png

I hope this helps,

Erich