Subject: Re: [boost] [msvc] #warning preprocessor directive
From: Robert Ramey (ramey_at_[hidden])
Date: 2017-10-17 15:30:57
On 10/17/17 5:10 AM, Beman Dawes via Boost wrote:
> I find it very irritating that VC++ does not support #warning, and have
> opened a feature request:
> The last time #warning was suggested it was rejected because not enough
> people voted for it. So please consider upvoting it on the above link.
> The lack of #warning affects Boost libraries in that developers avoid
> otherwise useful warnings because of the hassle for using an extension not
> supported by VC++.
personally I don't see any difference between #warning and the already
existing and portable #pragma message - which is what I use on a regular
What I have always wanted is the equivalent of static_warning(condition,
message). Of course this would be like static_assert except that it
wouldn't be an error. The need for this comes up when I can detect at
compile time that something is likely not what the user intended, but is
not necessarily wrong. One example of this would be an attempt to
serialize some data type via a non const reference. This would work,
but it leaves open that possibility that the users serialize functions
alter the data being serialized, which would break the presumptions made
by the serialization library.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk