"David Abrahams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Shouldn't we stick the -b- option in our borland toolset, since it > increases conformance?
In C++ Builder you can use a #pragma to ensure enum size from within a header file using enums no matter how the -b option is set by the user. This ensures binary compatibility. I use this technique all the time with enums in my own Borland header files. The Regex++ library uses it also as Dr. Maddock can affirm. #pragma option push -b- // or #pragma option push -b // enum(s) here #pragma option pop > > Gennaro Prota <[EMAIL PROTECTED]> writes: > > > On Sun, 26 Jan 2003 10:05:51 -0500, "Edward Diener" > > <[EMAIL PROTECTED]> 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. > > > > _______________________________________________ > > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > > > > -- > David Abrahams > [EMAIL PROTECTED] * http://www.boost-consulting.com > Boost support, enhancements, training, and commercial distribution > > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost