Re: size of an integer ??

From: Keith Thompson (kst-u_at_mib.org)
Date: 08/27/04


Date: Fri, 27 Aug 2004 02:13:10 GMT

Shalini <Shalini.1bmjpo@mail.codecomments.com> writes:
> what does the size of an integer depend on ?? is it the Operating
> system, processor or the associated memory in the system ??

It depends on the judgement of the implementer of the compiler,
subject to the restrictions in the standard. That judgement in turn
typically depends on the nature of the underlying system (int is very
often, but not always, the size of a CPU data register; sizes of other
integer types can depend on what the hardware conveniently supports).
Compatibility with other systems can also be a consideration; a
compiler for a "32-bit" system might have 16-bit int for compatibility
with older "16-bit" versions of the system. (I put "16-bit" and
"32-bit" in quotation marks because there's no universal agreement on
what those terms mean.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.


Relevant Pages

  • Re: Standard integer types vs types
    ... of not knowing what you've really got that using int and long does to ... The compiler cannot definitively make a policy about what ... signed integer type that has at least 16 width. ... also needed for backward compatibility (stdint.h is a new thing from ...
    (comp.lang.c)
  • Re: It Pays to Enrich Your C Skills
    ... Check if you can score a perfect 10 (without using a compiler). ... int main{ ... struct bitfield { ... out if it is a negative integer constant or a constant expression ...
    (comp.lang.c.moderated)
  • OT: Re: Perl Peeves
    ... I see the result of a test being used as an int. ... the compiler just assumed you knew what you were doing ... introduced to the language later, so void * was unheard of in most code. ... This didn't mean bool was special, declaring it just signaled to the ...
    (comp.lang.perl.misc)
  • Re: OT: Re: Perl Peeves
    ... when I see the result of a test being used as an int. ... compiler just assumed you knew what you were doing and would ... This didn't mean bool was special, declaring it just signaled to the ... What "normalization of bool results is built into the compiler"? ...
    (comp.lang.perl.misc)
  • Re: cpu type idea
    ... compiler related recently. ... int main ... float a; ... just to parallelize the vectror and tensor operations. ...
    (alt.lang.asm)