Size of basic types
Daniel Jacobowitz
drow@false.org
Thu Dec 2 21:50:00 GMT 2004
On Thu, Dec 02, 2004 at 10:04:34PM +0100, Jean-Eric Cuendet wrote:
>
> >>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.
>
> 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?
I'm not at all sure this will work, but you could try:
typedef long OurInt __attribute__((mode(SI)));
That will be a very strange type - basically "long" for the purposes of
the type system but only 32 bits. I have no idea what overload
resolution will do with it.
--
Daniel Jacobowitz
More information about the Gcc
mailing list