From: Steve Graegert <graegerts@gmail.com>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: C programming list <linux-c-programming@vger.kernel.org>
Subject: Re: relationship between standard C and gcc compiler suite?
Date: Wed, 3 Aug 2005 19:12:31 +0200 [thread overview]
Message-ID: <6a00c8d5050803101241bcceb5@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.63.0508030942160.7360@localhost.localdomain>
On 8/3/05, Robert P. J. Day <rpjday@mindspring.com> wrote:
>
> according to my 5th ed. of H&S, C99 introduced the unsigned integer
> type "_Bool" and refers to the corresponding header file stdbool.h.
> but on my linux system, that header file is not in the standard
> /usr/include directory, where i would have expected it.
>
> rather, it's included with gcc-4.0.1, and it's in this directory:
>
> /usr/lib/gcc/i386-redhat-linux/4.0.1/include
>
> i'm sure the end result is the same in that i can just
>
> #include <stdbool.h>
>
> but is there some kind of overall rationale as to what "standard"
> header files would actually be supplied by gcc itself? just trying to
> figure out the pattern here. obviously, this question generalizes to
> more than just asking about the boolean file.
Since C++ provides bool as a true boolean type <stdbool.h> is provided
to allow C code being compiled as C++ and to prevent name clashes.
Some C programs #define "bool" and/or "true" and "false" possibly
causing compatibility problems when compiled as C++.
In case of GCC, including <stdbool.h> cleans up #defines and allows
C++ compilation. It is therefore recommended to #define these
identifiers only when _needed_ and after including <stdbool.h>.
<stdbool.h> is provided as an extension and, for this reason, not
placed into the include directory of the C standard library.
Regards
\Steve
--
Steve Graegert <graegerts@gmail.com>
Software Consultancy {C/C++ && Java && .NET}
Mobile: +49 (176) 21248869
Office: +49 (9131) 7126409
next prev parent reply other threads:[~2005-08-03 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-03 13:47 relationship between standard C and gcc compiler suite? Robert P. J. Day
2005-08-03 17:12 ` Steve Graegert [this message]
2005-08-03 17:22 ` Robert P. J. Day
2005-08-03 17:31 ` Steve Graegert
2005-08-04 11:06 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d5050803101241bcceb5@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=rpjday@mindspring.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.