Re: short circuit evaluation
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Wed, 17 Sep 2008 21:29:06 -0400
Keith Thompson wrote:
CBFalconer <cbfalconer@xxxxxxxxx> writes:
James Kuyper wrote:
... snip about <stdbool.h> ...
You're right - my mistake. But I mis-remembered it as a standard
typedef because it makes more sense to me that it would be a
typedef. Does anyone know why it's a macro? I suppose it might be
because you can #undef a macro, but you can't turn off a typedef.
If you want to use 'bool' as the standard macro in one part of a
translation unit, and as a user-defined identifier with an
incompatible meaning from legacy code in a later part of the same
translation unit, making 'bool' a macro allows you do so. But
that seems like too convoluted a motivation for such a choice.
Because 'bool' was not a reserved word in C90. This way you can
keep the compiler compatible with C90 source that used it, and true
and false macros, differently. Note that _Bool IS a reserved word,
but is in the implementors namespace.
The question is why 'bool' is a macro rather than a typedef, not why
it's not a keyword in C99.
Which is what I thought I said.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
.
- Follow-Ups:
- Re: short circuit evaluation
- From: James Kuyper
- Re: short circuit evaluation
- From: Keith Thompson
- Re: short circuit evaluation
- References:
- short circuit evaluation
- From: Lassie
- Re: short circuit evaluation
- From: sh . vipin
- Re: short circuit evaluation
- From: jameskuyper
- Re: short circuit evaluation
- From: vippstar
- Re: short circuit evaluation
- From: James Kuyper
- Re: short circuit evaluation
- From: CBFalconer
- Re: short circuit evaluation
- From: Keith Thompson
- short circuit evaluation
- Prev by Date: Re: question realted to void *
- Next by Date: Re: short circuit evaluation
- Previous by thread: Re: short circuit evaluation
- Next by thread: Re: short circuit evaluation
- Index(es):
Relevant Pages
|