Deutsch English Français Italiano |
<vfr5rg$1ku3s$1@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: Richard Harnden <richard.nospam@gmail.invalid> Newsgroups: comp.lang.c Subject: Re: constexpr keyword is unnecessary Date: Tue, 29 Oct 2024 17:26:08 +0000 Organization: A noiseless patient Spider Lines: 26 Message-ID: <vfr5rg$1ku3s$1@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> <vfj5up$3q2lf$1@dont-email.me> <20241027220459.109@kylheku.com> <vfnu92$vp1g$1@dont-email.me> Reply-To: nospam.harnden@invalid.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 29 Oct 2024 18:26:09 +0100 (CET) Injection-Info: dont-email.me; posting-host="127420d604711db7f3817827c2aadaff"; logging-data="1734780"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19K9/1LZ1KIKWPYjPvs31f3pejFimPMD9Q=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:24OomS4NeEMlWyU7cYPzqTI5B9s= Content-Language: en-GB In-Reply-To: <vfnu92$vp1g$1@dont-email.me> Bytes: 2183 On 28/10/2024 11:58, Thiago Adams wrote: > > 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. If that is what you want, then why not simply say: const unsigned char ch = 210; Or change it to the char to a short (or int, long, etc). ? It's a good and helpful warning. I cannot see why you'd want to ignore it. Do you expect to remember that 1234 really equals 210 in five years time?