Mamluk Caliph <mamluk.caliph@[EMAIL PROTECTED]
> writes:
[...]
> By the way, I tried defining my own types and thought I could do
> something as follows:
>
> #if sizeof(int)==4
> typedef int myInt32_t;
> #endif
>
> This results in a compilation error `missing binary operator before
> token "("`, why is that? I thought sizof was just a macro.
[...]
No, sizeof is a built-in unary operator. (Its symbol happens to be a
keyword rather than a punctuation symbol.) The preprocessor doesn't
the "sizeof" or "int" keywords, so you can't use "sizeof(int)" in a
"#if" directive.
You can use the macros defined in <limits.h> in preprocessor
directives, though, and since these specify the ranges that the types
can represent rather than the sizes of their representations, they
might be more appropriate.
--
Keith Thompson (The_Other_Keith) <kst-u@[EMAIL PROTECTED]
>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


|