Reputation: 31
I've been going through some types defined in libgcc. They are all apparently mapped to the same type named bogus_type
. I can not find its definition.
#define SItype bogus_type
#define USItype bogus_type
#define DItype bogus_type
#define UDItype bogus_type
#define SFtype bogus_type
#define DFtype bogus_type
What does this type map to? Is it even a valid type or something like NULL
?
Upvotes: 1
Views: 204
Reputation: 19443
Since the define
is just a text replacement that take place before the compilation phase, as long as no one will use the defined type, there be no replacement to bogus_type
and nothing will happen. If someone will use those types, they will be replaced with bogus_type
which is in fact not defined anywhere which will make the compilation to failed.
so basically bogus_type
is just a rabbis that is used to forcely failed the build in case of a use in a specific type. For the sake of it, it could be:
#define SItype you_are_using_a_type_you_should_not_be_using!
Upvotes: 0
Reputation: 9485
Here's another example of this "type" being used.
/* Make sure that we don't accidentally use any normal C language built-in
type names in the first part of this file. Instead we want to use *only*
the type names defined above. The following macro definitions insure
that if we *do* accidentally use some normal C language built-in type name,
we will get a syntax error. */
#define char bogus_type
#define short bogus_type
#define int bogus_type
#define long bogus_type
#define unsigned bogus_type
#define float bogus_type
#define double bogus_type
That said, it's not a type. It's a legitimate code breaker to enforce the restriction on using certain types in certain places of the program. Should it fire, compilation should fail with a syntax error, since bogus_type
does not exist.
It's not any "less-than-known" part of the language, it's just clever use of the C preprocessor.
Upvotes: 4
Reputation: 18341
It is put before some code that should not accidentally use one of these types later on. So if it is using one of these, the compiler would throw an error, since there is no such a bogus_type
type.
Upvotes: 0