On 8/3/05, Kirkwood, David A <[EMAIL PROTECTED]> wrote:
> I have an client server application which is comprised of a 64bit-word
> servers and clients  and clients  and 32 bit word word clients. When this
> was 32 bit only I used htons and htonl etc and everything worked fine. Is
> there such a standard for the addition of 64 bit-word systems or is it up to
> be to handle this on my own. Assume that the integers always fit into 32
> bits, but what will happen in other systems when they don't?

David,

Unfortunately there is no short answer.  The size of integers and
other data types depend on the data model incorporated by the
underlying compiler and the machine.

Today three models are known:

(a) LP64 data model (long pointer 64 bits)
(b) ILP64 data model (integer long pointer 64 bits, not ANSI C)
(c) LLP64 data model (long long pointer 64 bits)


Datatype  LP64 ILP64 LLP64 ILP32 LP32 
------------------------------------
char      8    8     8     8     8 
short     16   16    16    16    16   
int       32   64    32    32    16 
long      64   64    32    32    32 
long long 64   
pointer   64   64    64    32    32 


Most vendors, namely DEC, Hewlett-Packard, IBM, Novell, SCO and Sun
Microsystems, endorsed the new LP64 data model and although it is not
offically standardized they silently agreed on this model. 
Nevertheless, they are expected to provide systems that simultaneously
support both, LP64 and ILP32 (the traditional model for 32-bit
machines), or even all three.

Since the transition from ILP32 to LP64 is quite natural and requires
only minor changes to standard libraries you can still make use of
htons and htonl.

Regards

        \Steve

--

Steve Graegert <[EMAIL PROTECTED]>
Software Consultancy {C/C++ && Java && .NET}
Mobile: +49 (176)  21248869
Office: +49 (9131) 7126409
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to