Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: constexpr keyword is unnecessary Date: Tue, 05 Nov 2024 07:48:11 -0800 Organization: A noiseless patient Spider Lines: 23 Message-ID: <86ses5smv8.fsf@linuxsc.com> References: <877ca5q84u.fsf@nosuchdomain.example.com> <87y12jpxvl.fsf@nosuchdomain.example.com> <87plnvpgb9.fsf@nosuchdomain.example.com> <20241027220459.109@kylheku.com> <20241028215919.996@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 05 Nov 2024 16:48:12 +0100 (CET) Injection-Info: dont-email.me; posting-host="22162f0ba694a79b67a6bd5db328b824"; logging-data="1682490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QYGUvzdb3j/TPPdX6/J02o+W2K6nlDsI=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:+Zyj417C50+1Jkn8IKpAdf8zC/k= sha1:cPzzmh0wv1ABBzBiNFWh4AtU3nI= Xref: csiph.com comp.lang.c:388870 Kaz Kylheku <643-408-1753@kylheku.com> writes: > On 2024-10-28, Thiago Adams wrote: > >> I believe warnings in code should be treated as alarms that require >> acknowledgment. >> >> For instance, >> >> const unsigned char ch = 1234; >> >> GCC: >> warning: unsigned conversion from 'int' to 'unsigned char' changes value >> from '1234' to '210' [-Woverflow] >> >> The programmer might intend this behavior; in that case, the "alarm" >> should be acknowledged. >> >> I would like a portable (standardized) way to achieve this. > > For conversion warnings, that portable way should ideally be a cast. A commonly held view, but a bad idea nonetheless.