newbie C99 question

M

Mark Bruno

Why is the keyword for the new built in boolean type _Bool and not bool?
Why should I have to include stdbool.h everytime i want to use bool instead
of _Bool? (I guess i have the same question for _Complex and _Imaginary).
 
A

Arthur J. O'Dwyer

Why is the keyword for the new built in boolean type _Bool and not bool?
Why should I have to include stdbool.h everytime i want to use bool instead
of _Bool? (I guess i have the same question for _Complex and _Imaginary).

Because many C90 programmers and implementations have already done
this:

typedef int bool;

or this:

#define bool unsigned char

somewhere buried inside their projects, and the C99 people rightly
decided to make life easier for them.
No C90 programmer should have been writing

typedef int _Bool;

because the identifier '_Bool' was (and still is) reserved for
the implementation's use only. Ditto with _Complex et alia.
It's a backwards-compatibility feature.

HTH,
-Arthur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top