long long vs long
Timothy Writer
Tim.Writer@ftlsol.com
Sat Jul 25 01:22:00 GMT 1998
michael@weiser.saale-net.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.Writer@ftlsol.com
FTL Solutions Inc.
Toronto, Ontario, CANADA
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
More information about the Cygwin
mailing list