Subject: Re: long long vs long
From: [email-masked] (Michael H. Warfield)

23 Jul 1998 01:20:23 -0700
Message-ID: <[email-masked]>
References: <73B8DC108A44D111B44700805FF5C69D01E51F@cware>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
To: [email-masked] (Graham Murray)
Cc: [email-masked]

Graham Murray enscribed thusly:
> This is probably a silly question, but rather than having long long for
> 64 bit, why was long not made 64bit? The standard (AFAIK) states that
> short <= int <= long.  So, it should be possible for long to be 64 bit
> rather than 32. This would give a simple progression from 8bit chars to
> 64bit longs.

	Unfortunately the standard also specifies the length of several
types.  Specifically char is 8 bits, short is 16 bits, and long is 32 bits.
The int type is NOT a specific length but is platform dependent, so an int
on earlier (XENIX and MS-DOS) systems use to be 16 bits while on modern
systems it's 32 bits.  Specifically, an int is defined as the "native"
integer number representation.  Of course, all of these types are "signed"
and have "unsigned" equivalences.  And before have the list jumps on me,
yes I know that unsigned and signed char's get into some interesting
ambiguities, particularly with old code that assumed that a char was
unsigned...

	Most code uses "int" where it wants the native number
representation.  That same code uses "short" and "long" where it wants
specific field lengths.  Imagine the havock that will transpire in code
with masks such as "foo = bar & 0xffff0000L" if you were to expand
long to be 64 bits.  The porting nightmare would make a sequel to
"Nightmare on Elm Street".

	Mike
-- 
 Michael H. Warfield    |  (770) 985-6132   |  [email-masked]
  (The Mad Wizard)      |  (770) 925-8248   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".