delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/25/03:53:10

From: Tim DOT Writer AT ftlsol DOT com (Timothy Writer)
Subject: Re: long long vs long
25 Jul 1998 03:53:10 -0700 :
Message-ID: <m33ebrm6oa.fsf.cygnus.gnu-win32@snoopy.ftlsol.com>
References: <901200141 DOT 0020725 DOT 0 AT office DOT demon DOT net>
Mime-Version: 1.0 (generated by tm-edit 7.108)
To: michael AT weiser DOT saale-net DOT de (Michael Weiser)
Cc: Harry Broomhall <haeb AT demon DOT net>, gnu-win32 AT cygnus DOT com

michael AT weiser DOT saale-net DOT de (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                                              Tim DOT Writer AT ftlsol DOT com
FTL Solutions Inc.
Toronto, Ontario, CANADA
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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