|
Boost : |
Subject: Re: [boost] [PREDEF] Review for the Boost.Predef library by Rene Riviera
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2012-02-28 07:24:30
Rene Rivera wrote:
> On 2/26/2012 9:06 AM, Bjorn Reese wrote:
>
> > But you also define macros for all non-pertinent platforms
> > and set their value to 0.0.0.
>
> Right.
[snip]
> > However, this design decision makes the by far most common
> > use case (#ifdef MACRO) more difficult in order to support a
> > rare use case (if (MACRO)). This is not how developers are
> > used to working with platform macros, and it will be an
> > eternal source of confusion.
>
> I guess that depends on the developers. The reasons the macros
> are always defined, to zero when not detected, is to reduce
> the amount of checks when writing conditionals. At least in
> Boost, the common use case goes something like this:
>
> #if defined(_some_compiler_) && (_some_compiler_ < 123)
> //...
> #endif
[snip]
> This is because many times we are interested in a particular
> version number not just if it's one platform vs. another.
However, if _some_compiler_ is always set, to 0.0.0 if to nothing else, then the first test is useless. Besides, I frequently write conditional code of the following form:
#if defined _some_compiler_
//...
#endif
That is, the version is not relevant to me, either because I can assume a limited version range, or because I've rejected irrelevant versions elsewhere.
If _some_compiler_ is always defined, even if to 0.0.0, then such tests are not possible.
Did I miss something?
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com
________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk