Thank you all for your thoughts....
I asked this trivial question only for the reason that this question was asked 
in one of my orals and the examiner told me that DOS works in real mode and 
Windows in protected so the difference in the sizes of int.
I dont think this is true...what do you all think?

Ciao,
Ajinkya


----- Original Message ----
From: Nico Heinze <[EMAIL PROTECTED]>
To: [email protected]
Sent: Sunday, 13 May, 2007 11:59:35 AM
Subject: [c-prog] Re: sizeof int

--- In [EMAIL PROTECTED] com, "Brett W. McCoy" <idragosani@ ...> wrote:
>
> On 5/13/07, ajinkyakale_ 86 <ajinkyakale_ [EMAIL PROTECTED]> wrote:
> 
> > Why is it that some compilers allocate 2 bytes for "int"
> > (eg: turboC) and some allocate 4 bytes(eg: VC++ visual studio)
> 
> It's dependent on the OS -- Turbo C is targeted for 16-bit
> operating systems (i.e., MS-DOS) whereas VC++ is targeted
> for 32-bit (or higher) operating systems.
> 
> -- Brett

In addition, the ANSI standards don't impose too much restriction on
those data sizes; in fact you can as well find some platforms where
sizeof( int) == 8. And I'm pretty sure you will also find
architectures where sizeof( int) == 6; and in a few years you will
also find sizeof( int) == 16.
In other words: whatever the compiler writers considered useful

Regards,
Nico





      Office firewalls, cyber cafes, college labs, don't allow you to download 
CHAT? Click here: http://in.messenger.yahoo.com/webmessengerpromo.php

[Non-text portions of this message have been removed]

Reply via email to