The int is architecture dependent as you say; its size will usually be
that which the CPU performs the most efficient integer math.
Strictly speaking, the only guarantee in the C standard about shorts and
longs is:
long >= int >= short.
You can use limits.h to set up explicitly sized types if necessary. This
is not the best for over-the-net portability, however. I have only used
the method when doing intensive fixed-point math for signal processing.
Paul Kerr
-----Original Message-----
From: Tuan Hoang <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, September 21, 1999 7:39 PM
Subject: 64-bit vs 32-bit with passing data on the net
>Hi,
>
>Let's say I have the following message struct that I pass
>around.
>
>struct packet {
> u_char type;
> u_long length;
> int foo;
> u_short bar;
>};
>
>When I go from a 32-bit to 64-bit machine, I could have sworn
>that the "int" was architecture dependent and not the "long".
>According to Steven's UNP vol1, it says that the "int" will stay at
>32-bits and the long as 64-bits. Also that the "short" will stay at
>16-bits.
>
>Is this a right?
>
>Thanks,
>Tuan
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-net" in
>the body of a message to [EMAIL PROTECTED]
>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]