ijt
ijt

Reputation: 3845

Why does GNU configure define macros for SIZEOF_INT etc. as specific integer values?

If you're going to define these at all, why not define them as

#define SIZEOF_INT sizeof(int)

etc. so they are correct even if someone tries to use them to compile against a different architecture?

Upvotes: 6

Views: 175

Answers (1)

ijt
ijt

Reputation: 3845

I found the answer a minute after asking the question. These macros are sometimes used in the predicates of #if etc. where sizeof calls cannot be evaluated.

For example

#if SIZEOF_LONG_LONG_INT == 8
stuff
#endif

Upvotes: 8

Related Questions