Re: [boost] [endian] Refresh based on comments received

----Original Message---- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Beman Dawes Sent: 08 June 2006 17:51 To: boost@lists.boost.org Subject: Re: [boost] [endian] Refresh based on comments received
Gennaro Prota wrote:
* there is no guarantee that an unsigned char has 8 bits...
The C and C++ standards specify char, signed char, and unsigned char all have exactly 8 bits, AFAIK.
No. They all have AT LEAST 8 bits, but there are certainly C implementations with 9-bit char and 32-bit char. I don't know if any of these have C++ compilers (but the standard certainly permits it). (You might of course decide to explicitly limit your library to 8-bit char platforms only.) -- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 203894

On 6/9/06, Martin Bonner <martin.bonner@pitechnology.com> wrote:
No. They all have AT LEAST 8 bits, but there are certainly C implementations with 9-bit char and 32-bit char. I don't know if any of these have C++ compilers (but the standard certainly permits it). (You might of course decide to explicitly limit your library to 8-bit char platforms only.)
How do those C implementations handle I/O? Does fgetc actually give the next 9 or 32 bits of the file? If, for example, the sockets implementation actually filled all 9 bits in a byte on a recv, I could see that being a portability nightmare... ~ Scott McMurray

Martin Bonner wrote:
----Original Message---- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Beman Dawes Sent: 08 June 2006 17:51 To: boost@lists.boost.org Subject: Re: [boost] [endian] Refresh based on comments received
Gennaro Prota wrote:
* there is no guarantee that an unsigned char has 8 bits... The C and C++ standards specify char, signed char, and unsigned char all have exactly 8 bits, AFAIK.
No. They all have AT LEAST 8 bits, but there are certainly C implementations with 9-bit char and 32-bit char.
Thanks for pointing this out. Seem my reply to Kim Barrett.
I don't know if any of these have C++ compilers (but the standard certainly permits it). (You might of course decide to explicitly limit your library to 8-bit char platforms only.)
I don't mind limiting the implementation to 8-bit char platforms, but I would like to make the specification suitable for other char sizes if that makes sense. How do 9-bit char and 32-bit char platforms do disk I/O? Do these platforms even have disk I/O sub-systems? Thanks, --Beman
participants (3)
-
Beman Dawes
-
Martin Bonner
-
me22