Deutsch English Français Italiano |
<vfliu0$fkhq$3@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: constexpr keyword is unnecessary Date: Sun, 27 Oct 2024 15:32:32 +0100 Organization: A noiseless patient Spider Lines: 58 Message-ID: <vfliu0$fkhq$3@dont-email.me> References: <veb5fi$3ll7j$1@dont-email.me> <877ca5q84u.fsf@nosuchdomain.example.com> <vf0ijd$3u54q$1@dont-email.me> <vf0l98$3un4n$1@dont-email.me> <vf1216$p0c$1@dont-email.me> <87y12jpxvl.fsf@nosuchdomain.example.com> <vf1d2o$2hjk$1@dont-email.me> <87plnvpgb9.fsf@nosuchdomain.example.com> <vf2sm8$deou$1@dont-email.me> <vf7m4s$1d8mj$1@raubtier-asyl.eternal-september.org> <vf86uc$1fvt3$1@dont-email.me> <vfit29$3obkb$1@dont-email.me> <86o736upof.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 27 Oct 2024 15:32:32 +0100 (CET) Injection-Info: dont-email.me; posting-host="fb2008f128462439dac0dc9109a21964"; logging-data="512570"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nPvgu37uZ4h1BQ9oUiufLYvqyS6hLIPg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:duIqY5ekSHtA5umUJ9lS+HS0YGA= Content-Language: en-GB In-Reply-To: <86o736upof.fsf@linuxsc.com> Bytes: 3903 On 27/10/2024 05:37, Tim Rentsch wrote: > Vir Campestris <vir.campestris@invalid.invalid> writes: > >> 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. > > Everyone agrees that all warnings should be fixed. Where people > differ is what set of warning conditions should be enabled. > > At (or at least near) one end of the spectrum is -pedantic. Note that for most code, strict conformance to C standards is not a major concern - most programs are at least somewhat platform specific or compiler-specific. If that is the case, then it is a good thing to use non-standard features if they make the code clearer or open the possibility of more static checking. > > At the other end of the spectrum is -Weverything in clang. (I > confess I am sort of assuming that -Weverything includes every > warning condition known to man, which might not be the case. But > I trust people can understand what is meant by "-Weverything".) > As I understand it, "-Weverything" was more intended for tests of the compiler than an option anyone should use in practice. More realistic, I think, would be "-Wall -Wextra" which enables several warnings that many people would feel give a lot of hits on perfectly good code. > I expect most people would advocate a point somewhere between the > two extremes. But there are different ideas about where that > point should be. > Yes - and there /should/ be different ideas there. > Whether warnings can or should be turned into errors is a > separate question. The first question is what set of warning > conditions should be enabled. A statement that all warnings > should be fixed is meaningless if there is no indication of > what warning conditions should be enabled. Agreed - deciding on the warnings to use is critical. In my mind, the important aspect of turning warnings into errors is that the won't be overlooked or forgotten. It's easy to miss warnings in the middle of larger builds - errors are usually much harder to ignore (intentionally or unintentionally).