Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-01-26 11:26:37


On Sun, 26 Jan 2003 10:05:51 -0500, "Edward Diener"
<eddielee_at_[hidden]> wrote:

>For Borland, the default is to make enum's int sized but this can be changed
>with the -b- option in which enums are made as small as possible depending
>on the range.

Yes. The original problem, anyhow, was not about making them small but
making them large and giving them the right signedness, like in:

   enum { e = 2147483648u };

Actually the -b- option also has this effect (thus with that option e
< 0 would yield false, as required by C++) but the help file provided
with Borland command line tools has an error that can be misleading in
that regard. It says:

   When this option is off (-b-), the compiler allocates the
   smallest integer that can hold the enumeration values:
   the compiler allocates an unsigned or signed char if the values
   of the enumeration are within the range of 0 to 255 (minimum) or
   -128 to 127 (maximum), or an unsigned or signed short if the values
   of the enumeration are within the following ranges:

     0 to 4,294,967,295 or -2,147,483,648 to 2,147,483,647

It seems to refer only to types not larger than int, leading to think
that -b- is just a space optimization. Instead it also concerns sign.

Note the last sentence: the ranges are those of unsigned and signed
*int*, not short :-) Probably there's a whole part in the middle that
got lost for some reason, which should be:

   ..unsigned or signed short if the values... are within

     0 to 65535 or -32768 to 32767

   or an unsigned or unsigned *int* if they are in
   the range

     0 to 4,294,967,295 or -2,147,483,648 to 2,147,483,647

Genny.


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