I have come across the following problem, and I could not find any specific explanations as to: Why does C bother to provide type definitions ? Isn't defining BOOL macro just as good as defining Bool type using typedef
?
For example, #define
directive can be used to create a macro that could be used as a Boolean type:
#define Bool int
There's another way to set up a Boolean type, using a feature known as type definition.
typedef int Bool;
Why is the last method preferred? What are the advantages?