Sujet : Re: constexpr keyword is unnecessary
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 26. Oct 2024, 16:08:09
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vfj5up$3q2lf$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Mozilla Thunderbird
On 10/26/24 10:07, Vir Campestris wrote:
On 22/10/2024 13:48, Thiago Adams wrote:
>
I think a more generic feature would be to have a standard way of
promoting selected warnings to errors. This would avoid stacking
features with small differences, such as treating constexpr as a special
case compared to other constant expressions in C.
I have in the past had coding standards that require you to fix all
warnings. After all, sometimes they do matter.
I disapprove of that policy. A conforming implementation is free to warn
about anything, even about your failure to use taboo words as
identifiers. While that's a deliberately silly example, I've seen a fair
number of warnings that had little or no justification.
The purpose of warnings is to tell you that there might be a problem. If
the compiler is certain that there's a problem, it should generate an
error message, not a warning. Therefore, treating warnings as if they
were error messages means that you're not doing your job, as the
developer, to determine whether or not the code is actually problematic.