Re: 32-bit on 10.8
Re: 32-bit on 10.8
- Subject: Re: 32-bit on 10.8
- From: "Glenn L. Austin" <email@hidden>
- Date: Sun, 12 Aug 2012 07:06:20 -0700
- Sun-java-system-smtp-warning: Lines longer than SMTP allows found and truncated.
On Aug 12, 2012, at 1:57 AM, Vincent Habchi <email@hidden> wrote:
> That’s from the hardware side. Unfortunately, since most people gave up programming in assembly (what a loss! ;)) in favor of C, its derivatives, or other various high level languages, there was a need to nail down the width of various data type. So we ended up with a 'int' 32-bit wide, which was the most reasonable choice at the time the C was normalized because processors had 32-bit data and address registers, and as a side benefit, we could bet that sizeof (int) = sizeof (void *). When these moved to 64-bit, C 'int' should have followed, since both data and address registers were doubled, but it was not done (why? Because we would have lacked a 32-bit qualifier? Some other side effect?). So we ended up with sizeof (int) != sizeof (void *). And mainly I guess that’s what is meant by '64-bit' from the developer point of view, besides – of course – utilizing libraries compiled with the 64-bit instruction set.
The reason that sizeof(int) != sizeof(void *) goes back to programmer laziness (really!).
For years, files were written that assumed that sizeof(int) was 4 bytes, even though the long data type was explicitly designed for that value, AND types were introduced to the language that explicitly defined bit lengths (int8_t, int16_t, int32_t, int64_t). However, because programmers generally are lazy and didn't want to go back an re-code all of their legacy code to use the new bit-length-defined types, and because the C language "allowed" it (sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)), the standards body "froze" int as a 32-bit value.
--
Glenn L. Austin, Computer Wizard and Race Car Driver <><
"Where there's breath, there's hope!"
<http://www.austin-soft.com>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden