Boost logo

Boost :

Subject: Re: [boost] [config] Boost PP and variadic macros
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-04-03 15:01:12


On 4/3/2011 2:01 PM, John Maddock wrote:
>>>> [...] My initial thought was to see if config could work with C
>>>> compilers, but all investigation there has led me to believe that it
>>>> would be too many unnecessary changes to config, would complicate
>>>> config greatly, would need extensive testing against all compilers,
>>>> and that since config is central to all of Boost such a potential
>>>> massive change to it it is a bad idea. [...]
>>>
>>> What about simply wrapping everything in config, except the varadic
>>> stuff, in an "#ifdef __cplusplus"?
>>
>> That was the original thought. But it would mean testing each
>> compiler/version to make sure that __cplusplus was actually being set
>> when compiling a C++ program.
>
> __cplusplus is absolutely required to be set for C++ compilation, I've
> never heard of a compiler that doesn't set it in C++ mode.

I believe you, but I did not know if you wanted this in config and/or
trusted all the compilers config supports to implement this correctly.
Of course I absolutely know they should...

>
>>> It would be an unobtrusive change,
>>> and that define is required by every C++ standard I've seen (note: I've
>>> only seen working drafts, not the final copies, though I don't expect
>>> that part has changed).
>>
>> It might be unobtrusive but there are very many config header files in
>> which one would have to do that. Even doing it just for each
>> compiler's header file would mean that each compiler would have to be
>> tested which config supports. I do not think we even have every
>> compiler which config supports being tested regularly, but I may be
>> wrong.
>
> True enough, but there weren't many changes required: try SVN Trunk now,
> Boost.Config should compile in C mode as well as C++ mode now. Tested
> locally with msvc, gcc (all the versions I could find!), intel and sun.
> I've also added a C-language test case, and manually inspected the
> compiler and platform config files for C++ specific code. Lets see how
> that works out...

Thank you very much. I will look at it, and report back my changes to
allow variadic macro support checking without the need to have
__cplusplus defined ( in other words for a C compiler ).


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