www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/02/19:55:22

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using the atoi function...
Date: Fri, 02 Oct 1998 16:41:25 -0700
Organization: Alcyone Systems
Lines: 24
Message-ID: <361564A5.230474C3@alcyone.com>
References: <19981002165256 DOT 11675 DOT 00001371 AT ng108 DOT aol DOT com>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.34 i686)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Uhfgood wrote:

> I can type in up to 10 digits without displaying some
> other number... it's as if i had used a long and stead of an int, but
> it is for
> sure an int...  Can someone explain why i'm able to type up to 10
> digits with
> no problems.... I thought an integer could only hold up 32767...

The ANSI C standard makes few restrictions on the _actual_ sizes of
variables.  An int is guaranteed to be no smaller than a short, which by
the standard is guaranteed to be at least 16 bits (but may be more).

The int is intended to be whatever integer size is "natural" for the
native compiler.  For DJGPP (based on gcc), that's 32 bits.

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / Covenants without the sword are but words.
           / Camden

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019