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 <20241028215919.996@kylheku.com>
Deutsch   English   Français   Italiano  
<20241028215919.996@kylheku.com>

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: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: constexpr keyword is unnecessary
Date: Tue, 29 Oct 2024 05:04:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <20241028215919.996@kylheku.com>
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>
Injection-Date: Tue, 29 Oct 2024 06:04:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0543beae8c5228a5f9da4e18ac1ec954";
	logging-data="1517583"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18Ed/LYP9q4vU6N5zmIKdEJQ0GJeqJrkow="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:BXJIFUyqUuqsrNc5ZoUW19M4QkY=
Bytes: 2525

On 2024-10-28, Thiago Adams <thiago.adams@gmail.com> 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.

Any half-decent compiler should shut up if the conversion is
explicitly requested:

  const unsigned char ch = (unsigned char) 1234;

If not, complain to the compiler developer.

It works this way for conversions that are constraint violations,
like between unlike pointers. Assign a pointer to a variable of
the wrong type, and there is a required diagnostic. With a cast,
the diagnostic is not required, and it would be irksome if there
still were one.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca