Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-12-04 01:46:43


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Vambola Kotkas

> None of the available wave flags did seemingly help. Not
> that i need huge integers, however boost sometimes does have
> way bigger ones so it must be legal?

It's not. Or, more precisely, all values in expressions in #if or #elif
directives are promoted to the largest built-in type--namely, long or unsigned
long in current C++. Beyond that, if I recall correctly, underflow and overflow
produced by arithmetic results in undefined behavior.

> MS Visual C++ 7.1
> processes constants like 18446744073709551615 without any noise.
> See ... 1.33.0 boost/cstdint.hpp line(263):
> # if ULONG_MAX == 18446744073709551615 // 2**64 - 1
>
> Silly example 2:
> #define SHOW2(x) #x
> #define SHOW(x) SHOW2(Number is:##x)
> #pragma message( SHOW(__LINE__))
> Result:
> test.cpp(3): error: pasting the following two tokens does not
> give a valid preprocessing token: ":" and "__LINE__"
> Maybe its buggy and MS made its preprocessor too lousy there
> ... just for reference Visual C++ 7.1 preprocess result:

It is undefined behavior to paste together two tokens where the result is not a
single token. In this case, and in most cases like this, the concatenation is
pointless:

#define SHOW(x) SHOW2(Number is:x)

Just for the record, BTW, VC++ has a horrible preprocessor.

Regards,
Paul Mensonides


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