www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/19/11:44:15

Date: Wed, 19 Mar 1997 11:23:34 -0500 (EST)
From: "art s. kagel IFMX x2697" <kagel AT dg1 DOT bloomberg DOT com>
To: Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA>
Cc: djgpp AT delorie DOT com
Subject: Re: Weird problem
In-Reply-To: <5ggll4$6pb@freenet-news.carleton.ca>
Message-Id: <Pine.D-G.3.91.970319112057.8712A-100000@dg1>
Mime-Version: 1.0

Yes they are.  More often than anyone would prefer.  You can always use a 
long and sacrifice 2bytes to the optimization god and still keep the gods 
of portabliity happy.  In this case only the demons of memory get 
sc----d. 

Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

On 16 Mar 1997, Paul Derbyshire wrote:

> 
> Tony O'Bryan (aho450s AT nic DOT smsu DOT edu) writes:
> > On Thu, 13 Mar 1997 16:19:47 -0600, Ray Ratelis <ray AT shoreland DOT com> wrote:
> > 
> >>It is because in Turbo C++, ints are 2 bytes in size. (int = 16bit,
> >>short int = 8bit(?))
> >>In PM, and any other 32bit OS, ints are 4 bytes in size. (int = 32bit =
> >>long int, short int = 16bit)
> > 
> > I believe that shorts are always guaranteed to be 16 bits, regardless of the
> > system.  Last I heard (I have never actually had access to the ANSI specs, and
> > had to learn everything through experience and word-of-mouth) integers take on
> > the size of the machine word of the computer compiling the program (hence 16-bit
> > DOS has 16-bit integers and GCC has 32-bit integers).  That is why the use of
> > ints hinders portability and the use of shorts and longs are preferred when
> > numbers need to be in specific ranges supported by those datatypes.
> > 
> > As usual, I am happy to receive insights that reduce my ignorance. :)  Please
> > correct me if I am wrong.
> 
> 
> But, an article on optimization informed me that using a 32-bit compiler
> like DJGPP, if you use shorts and such it adds a whole extra instruction
> for every operation in registers on the value in question, and that to
> speed up code use "int" instead. So I guess portability and optimization
> are sometimes exclusive?
> 
> --
>     .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
>  -()  <  When I go to the theater, I always go straight to the "bag and mix"
>     `*'  bulk candy section...because variety is the spice of life... [me]
> Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
> 

- Raw text -


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