Subject: Re: long long vs long
From: [email-masked] (Timothy Writer)

25 Jul 1998 03:53:10 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
To: [email-masked] (Michael Weiser)
Cc: Harry Broomhall <[email-masked]>, [email-masked]

[email-masked] (Michael Weiser) writes:

> Hi Harry,
> 
> You wrote:
> 
> >> No because the standard says
> >> short == 16 bit
> >> long  == 32 bit
> >> int   == 16 or 32 depending on the machine's architecture
> >> 
> >> For example: Under DOS int is 16 bit while under Win32 und UN*X it is
> >> 32 bit.
> >> So there's no way for long to be 64 bit while conforming to the
> >> standard.
> >  Oh dear - this seems to be a common belief.  Can you give the
> >para in the standard where it says this?
> Unfortunately not. I didn't know that this matters so much.
> 
> BTW: Do you love splitting hairs? ;)

In defense of the original poster, this is not splitting hairs.  You yourself 
invoked the _Standard_ to assert:

    1.  short is 16 bits and long is 32 bits
    2.  a conforming implementation cannot use a 64 bit long

Both statements are incorrect and such commonly held misbeliefs are a
frequent source of portability problems.  Since this group is very much about
portability, its important not to spread misinformation where portability is
concerned.

BTW, I'm not speaking from an "Ivory tower".  I recently had the job of
porting an application from NT to Digital UNIX with, you guessed it, 64 bit
longs.  The code is full of assumptions that a short is exactly 16 bits and a
long is exactly 32 bits.  Furthermore, the programmers never use int because
they don't know its size.  Needless to say the port was costly.  So, you see,
such distinctions do matter.

-- 
Tim Writer                                              [email-masked]
FTL Solutions Inc.
Toronto, Ontario, CANADA
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".