
Boost : 
Subject: Re: [boost] [Math.Constants] Help needed with the preprocessor
From: John Maddock (boost.regex_at_[hidden])
Date: 20111217 06:52:07
>This seems to work even with x = 1.0:
>
>BOOST_PP_SEQ_CAT( (1.0) (123) (e) (10) ) // 1.0123e 10
>
>But I'm not sure how this actually works inside Boost.Preprocessor...
Unfortunately neither of the ideas offered work for me, I tried:
#define C_(x, y) BOOST_JOIN(x, y)
#define C2_(x, y) BOOST_PP_SEQ_CAT((x)(e)(y))
int main()
{
float f = C_(5.0, e001);
float g = C2_(5.0, 001);
}
And the preprocessor produced:
int main()
{
float f = 5.0e 001;
float g = 5.0e 001;
}
Note the whitespace inserted before or after the "".
The strange thing is, if I invoke:
C_(5.0, 0e001)
Then I get:
5.00e001
And no whitespace anymore!
This leads to me to wonder if GCC is doing something special when it
recognizes that the token might be a valid number.... or else that this is
just blind luck?
Either way, I'd really like to find something that's actually guaranteed to
work, rather than just happens to :(
Thanks, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk