Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-09-20 06:42:18


David Abrahams writes:

> Aristid Breitkreuz <aribrei_at_[hidden]> writes:
>
>> You can't assume short is 16-bits (but that's more or less academic).
>
> Academic or no, I'd love to hear your reasoning on that one.

The standard is clear that short must be /at least/ 16 bits, but you
certainly can't assume that the following assert will not fire:
        unsigned short i = 32768;
        i *= 2;
        assert( i == 0 );

In practise, except on esoteric embedded DSPs where sizeof(almost
anything) is 1 and char is 32 bits, I can't imagine that assert firing
any time in the next 20 years (In 20 years time, I expect 128 bit
platforms to appear, and short *might* start meaning /32 bits/).

-- 
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