In the source code of stdbool.h
in LLVM project, it reads:
/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool, bool, false, true as a GNU extension. */
#define _Bool bool
#define bool bool
#define false false
#define true true
#endif
In the last 4 lines there are three lines of the from #define X X
. Why would you do that? What difference does it make? Wouldn't this force compiler to just replace, say, true
with true
?
Here is a basic guideline for affect or effect that can help clarify how to use the two words correctly: Generally, we use affect as a verb (an action word) and effect as a noun (an object word).
Affect is usually a verb meaning "to produce an effect upon," as in "the weather affected his mood." Effect is usually a noun meaning "a change that results when something is done or happens," as in "computers have had a huge effect on our lives." There are exceptions, but if you think of affect as a verb and effect as ...
Affect is most often used as a verb meaning “to have an impact on,” as in “The tornado barreling towards us will affect our picnic plans.” Continue reading...
The only reason I can think of is, that preprocessor statements like
#ifdef bool
// do some stuff or define bool
#endif
in other c files include afterwards will work proper and not trying to redefine bool in another way like
#define bool int
which would interfere with the first definition
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With