Re: type sizes
Re: type sizes
- Subject: Re: type sizes
- From: Wade Tregaskis <email@hidden>
- Date: Tue, 26 Oct 2004 14:59:19 +1000
With the move to 64bit on Tiger, I'm wondering how the types will
change. For example, will sizeof(size_t) == 8 instead of 4 as it is on
OSX 10.3 (which seems to violate the ISO C spec)?
Most things will remain the same size - int's are 4 bytes, shorts are
2, doubles are 8, floats are 4, etc. The main difference is long,
which is 8 bytes instead of 4. Additionally, long long used to be 8
(under 32-bit PPC)... I'm not sure what it is now (on my mythical G5 ;)
), although I'd suspect the same (watch out though for when we move to
128-bit processors ;) ). It's not an ANSI type anyway, so it's
probably implementation-dependant.
The key changes from the horses mouth (IBM) are just pointer sizes
(obviously 8 bytes instead of 4) and long's, which apparently are
supposed to always match the size of pointers - I'd never heard this
before, but it seems reasonable enough (and now that I look, this is
what all the BSD's expect). So anyone converting pointers to ints for
whatever reason is going to have headaches. Meaning, quite a lot of
people. For completely safety they should be using intptr_t anyway (or
uintptr_t).
So, knowing that, you should be able to trace down to size_t or
whatever other system type you like. It appears on Darwin size_t is a
_BSD_SIZE_T_, which is roughly equitable to unsigned long (although it
could also be __SIZE_TYPE__, which isn't defined anywhere in the system
headers... so I guess not). So, size_t will be 8 bytes on a 64-bit
system. Since this is defined in <ppc/ansi.h>, I'm guessing it's ANSI
C valid. If not, file a bug report, but I wouldn't expect the
behaviour to change any time soon.
Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN &
email: email@hidden, Jabber:
email@hidden
-- Sed quis custodiet ipsos custodes?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >type sizes (From: Steve Dekorte <email@hidden>) |