www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/23/16:01:59

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Are Longs Really Faster?
Date: Wed, 23 Sep 1998 12:36:11 -0700
Organization: Alcyone Systems
Lines: 29
Message-ID: <36094DAB.47271031@alcyone.com>
References: <360826d6 DOT 2082174 AT ct-news DOT iafrica DOT com>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Chris Brooker wrote:

> I heard somewhere that if you keep you data in longs it actually runs
> faster, so if you are worried about speed and new memory usage then
> you must keep your data in longs.

You probably mean ints, not longs.  In C, int is intended to be the
"natural" word size.  A long is guaranteed to be no smaller than an int,
and at least 32 bits, but other than that there are no other
restrictions.

> Is this true of:
> a) A 16 bit program? (Pacific C)
> b) A 32 bit program? (DJGPP (gcc))

int will be the "natural" word size on any platform or with any
compiler.  long may or may not be the same size as int, depending on the
compiler.  In typical 16-bit DOS compilers, an int is 16 bits, and a
long is 32 bits (though this is not mandated by the standard).  In
DJGPP, but int and long are 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
             \
            / Dead men have no victory.
           / Euripides

- Raw text -


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