Boost logo

Boost :

From: Kevin Lynch (krlynch_at_[hidden])
Date: 2002-11-27 12:05:30


Michael Walter wrote:

>>If a library user wants his archives to be portable he has to use
>>int8_t, int16_t, etc..

I don't remember seeing this pointed out, so forgive me if I just missed
it or am just stating the obvious, but:

These types are technically NOT portable, in two ways:

1) They are not defined by ISO C++ ... although they are required by
POSIX 1g, and are optional types in ISO C, C++ compilers are not
required to support them.

2) Although both POSIX and C99 define them to be 2's complement integers
with the appropriate number of bits, neither standard sets a requirement
on byte ordering within the multibyte types. Thus, even if a platform
supports them (say, the BSD family), the binary form of the integers is
not portable.

So, while use of them may lead to a MORE portable C++ interface, they
won't directly lead to a portable binary serialization format (although
you can clearly fix that problem in platform specific byte reordering code).

-- 
-------------------------------------------------------------------------------
Kevin Lynch				voice:	(617) 353-6025
Physics Department			Fax: (617) 353-9393
Boston University			office:	 PRB-361
590 Commonwealth Ave.			e-mail:	 krlynch_at_[hidden]
Boston, MA 02215 USA			http://budoe.bu.edu/~krlynch
-------------------------------------------------------------------------------

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk