Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vfr75e$1l8b8$1@dont-email.me>
Deutsch   English   Français   Italiano  
<vfr75e$1l8b8$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: Thiago Adams <thiago.adams@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: constexpr keyword is unnecessary
Date: Tue, 29 Oct 2024 14:48:29 -0300
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <vfr75e$1l8b8$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> <vfr5rg$1ku3s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 29 Oct 2024 18:48:30 +0100 (CET)
Injection-Info: dont-email.me; posting-host="55498c66dcd053969c17c2605d166640";
	logging-data="1745256"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ACt51eOzhdNVZauwU6+jFlCLWH3ngbhg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:CXUGyRtp3YYsUDQaJhAyRftVDtw=
In-Reply-To: <vfr5rg$1ku3s$1@dont-email.me>
Content-Language: en-US
Bytes: 3263

On 29/10/2024 14:26, Richard Harnden wrote:
> 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?
> 
> 
> 


When I use a concrete example, people often assume I’m discussing a 
specific case, even if I explicitly state that it’s just an example (and 
this happens all the time).

Here’s the main idea: Sometimes, we have warnings in our code. I’m 
proposing a feature that identifies warnings that necessary exists.

The issue with disabling warnings in specific code regions is that, if 
the code is changed to remove the warning, the disable command often 
isn’t removed. Additionally, with code modifications, we might 
unintentionally end up disabling more warnings than originally intended.

I also presented a sample with cast.

For the *specific sample*  of course there is an alternative of just 
wring the final  number.

Another sample:

In GCC

const int i = 1231231231231*123123123123123;

This is a warning about overflow. If the overflow is intentional, for 
instance, to observe the final result, the programmer can choose to 
dismiss the warning.