Size of basic types

Zack Weinberg zack@codesourcery.com
Thu Dec 2 21:11:00 GMT 2004


Jean-Eric Cuendet <jec@rptec.ch> writes:

>>>Is it possible to have:
>>>int => 32
>>>long => 32
>>>long long => 64
>>>void* => 64
>> No.  This will never be supported.
>
> OK, thanks for your quick answer.
> But is it possible in GCC to define my custom types.
> Saying:
>   newtype MyInt [32bits]
> or something like that?
> I can not do a typedef.

Not in C or any of the related languages.  I believe Ada has something
along these lines.

> My main problem is that:
> On 32bits platform:
>   OurBool => int => 32bits
>   OurInt  => long => 32bits
>   OurLong => long long => 64bits
> But in 64 bits:
>   OurBool => int => 32bits
>   OurInt  => long => 64bits      <=== The problem
>   OurLong => long long => 64bits
>
> So I changed OurInt to int instead of long. But then, I have problems 
> because we have overloaded methods with OurInt and OurBool, which were 
> different in 32bits mode (int and long) but are the same now in 64bits 
> (the 2 are int)...
> Any idea how to resolve that?

Change OurBool to some other type (the real bool comes to mind)?

zw



More information about the Gcc mailing list