From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-01-12 11:26:46
From: Chris Cleeland
> On Fri, 13 Jan 2006, Christopher Kohlhoff wrote:
>> Some thoughts, both for and against:
>> - Does unsigned char always imply 0..255?
>> Might there be a
>> standards-conforming C++ implementation where char is not 8
Yes. Plausible other values are 9 (for 36-bit word addressed machines),
and 32 (for DSPs where it is just too much heartache to slice a 32-bit
>> (Admittedly porting a sockets library, which inherently
>> deals in sequences of octets, to this architecture could be
>> rather difficult.)
Not as bad as you think. Each octet must be able to fit into an
unsigned char. It's just that an unsigned char can hold a value which
doesn't fit in an octet.
> Good question; I know that sizeof(char) == sizeof(unsigned char) ==
> 1, but I don't know that it's guarantee anywhere that something
> that has a sizeof==1 is exactly 8 bits.
It isn't. It is defined that unsigned char has AT LEAST 8 bits (because
it can hold 0..255).
-- Martin Bonner Martin.Bonner_at_[hidden] Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 203894
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk