Boost logo

Boost :

Subject: Re: [boost] [msvc] #warning preprocessor directive
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-10-17 17:36:00


On 10/17/2017 12:10 PM, Beman Dawes via Boost wrote:
> On Tue, Oct 17, 2017 at 11:42 AM, Andrey Semashev via Boost <
> boost_at_[hidden]> wrote:
>
>> On 10/17/17 16:14, Edward Diener via Boost wrote:
>>
>>>
>
>> Maybe someone could promote #warning as an official addition to the C++
>>> standard ?
>>>
>>
>> I think, if it has to be in a standard, it should become part of C first.
>
>
> Nowadays there is tighter liaison between the C and C++ committees, so if
> it gets proposed for C++ it will more-or-less automatically also get
> proposed for C.
>
> The C++ committee is really trying to get away from the preprocessor, so my
> guess is they would be more interested in Robert's static_warning
> suggestion, although they might want to recast even that as some sort of
> constexpr function.

There is an obvious difference between a preprocessor #warning and a
static_warning. I have not used #warning in gcc, but since it is a
preprocessor warning I assume it can only be created as part of
preprocessor logic, ie.

#if something
#warning message
#endif

etc, and on to more complicated things in libraries like boost pp or vmd.

Whereas a static_warning can occur in template code, constexpr code, and
anything else determined purely at compile time.

>
> --Beman


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