Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Integer mul...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 24485 of 28006
Post > Topic >>

Re: Integer multiplication truncation

by Keith Thompson <kst-u@[EMAIL PROTECTED] > Feb 2, 2008 at 01:17 PM

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"
 




 9 Posts in Topic:
Integer multiplication truncation
Mamluk Caliph <mamluk.  2008-02-02 04:46:32 
Re: Integer multiplication truncation
=?UTF-8?q?Harald_van_D=C4  2008-02-02 14:02:11 
Re: Integer multiplication truncation
Mamluk Caliph <mamluk.  2008-02-02 06:57:09 
Re: Integer multiplication truncation
Thad Smith <ThadSmith@  2008-02-02 10:26:32 
Re: Integer multiplication truncation
Keith Thompson <kst-u@  2008-02-02 13:17:29 
Re: Integer multiplication truncation
Keith Thompson <kst-u@  2008-02-02 12:58:31 
Re: Integer multiplication truncation
=?UTF-8?q?Harald_van_D=C4  2008-02-02 22:35:17 
Re: Integer multiplication truncation
Keith Thompson <kst-u@  2008-02-02 13:55:22 
Re: Integer multiplication truncation
Mamluk Caliph <mamluk.  2008-02-03 04:02:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 12:57:15 CST 2008.