i have an problem, i am writing a header file, which depending on the Sizes of the c standard datatypes, defines different Structs and Unions. I would need something like this:
#if sizeof(int) == 4
typedef struct {
int i;
} test;
#else
typedef struct {
long i;
} test;
#endif
sadly this doesnt work.
Does somebody know, how i can do this?
Thanks for your help.
You cant do it this way as preprocessor does not know anything about the C language, but for this purpose you have fixed size integer types which are standard and portable
typedef struct {
int32_t i;
} test;