Boost logo

Boost :

From: Aaron W. LaFramboise (aaronrabiddog51_at_[hidden])
Date: 2004-08-18 13:05:38


John Maddock wrote:
> How about something like:
>
> BOOST_EXTENSION(x)
>
> which expands to "__extension__ x" on gcc and "x" otherwise?
>
> Then we can use BOOST_EXTENSION(long long) where necessary.

This is what I initially tried to do. However, it is difficult to make
work.

Consider:

template<typename T> class myclass {
};
__extension__ template<> class myclass<long long> {
};

Note the placement of __extension__. This is the only place that
__extension__ can be placed that it will make the error go away, and not
trigger a parse error.

Simply prefixing "long long" with __extension__ does not, in general,
work. With complicated source lines, the placement of __extension__ may
be entirely non-obvious. It is possible, for certain constructs, that
there is no appropriate way that __extension__ might be added. In fact,
the documentation is not clear on exactly how __extension__ is supposed
to be placed, as (in my reading) its description does not correspond
with actual usage:
http://gcc.gnu.org/onlinedocs/gcc-3.4.1/gcc/Alternate-Keywords.html

Using __extension__ at each instance of long long would require anyone
using long long in Boost headers to know particular characteristics of
GCC in this regard, which I think is unacceptable. I think a typedef is
the only way to shield the rest of Boost from this issue.

Aaron W. LaFramboise


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