Deutsch   English   Français   Italiano  
<20241013162901.00001d08@yahoo.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: constexpr keyword is unnecessary
Date: Sun, 13 Oct 2024 16:29:01 +0300
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <20241013162901.00001d08@yahoo.com>
References: <veb5fi$3ll7j$1@dont-email.me>
	<vedv0a$5m19$1@dont-email.me>
	<veeqhi$ar0c$2@dont-email.me>
	<veg59o$kolq$1@dont-email.me>
	<vegbeb$llri$2@dont-email.me>
	<vegc3l$lqrd$1@raubtier-asyl.eternal-september.org>
	<vegevc$m5na$1@dont-email.me>
	<20241013160645.000015bc@yahoo.com>
	<veggrr$mbh9$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Oct 2024 15:28:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="892c1d91ddc3c98c5e442b7e028c5cd9";
	logging-data="3378373"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+Nbay/dRZchPhAcLfssA42P5ishEazteU="
Cancel-Lock: sha1:l9vzRrGcrhk1dmysn4B5n6dHw8g=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
Bytes: 2869

On Sun, 13 Oct 2024 10:10:19 -0300
Thiago Adams <thiago.adams@gmail.com> wrote:

> Em 10/13/2024 10:06 AM, Michael S escreveu:
> > On Sun, 13 Oct 2024 09:38:04 -0300
> > Thiago Adams <thiago.adams@gmail.com> wrote:
> >   
> >> Em 10/13/2024 8:49 AM, Bonita Montero escreveu:  
> >>> Am 13.10.2024 um 13:37 schrieb Thiago Adams:
> >>>      
> >>>> Yes.
> >>>> constexpr is like - "require the initializer to be a constant
> >>>> expression." But the compiler will have to check it anyway.  
> >>>
> >>> I cannot understand why you are so militantly against this
> >>> new language feature that can be understood in 10 seconds.
> >>>      
> >>
> >> I have seen code like this:
> >>
> >> void func()
> >> {
> >>      constexpr int c = 1;
> >>      f(c);
> >> }
> >>
> >> For some reason, people believe that adding constexpr will
> >> magically improve optimization. In reality, it doesn't change
> >> anything compared to const and often reflects a misunderstanding
> >> of how the compiler works. As a result, I end up having to explain
> >> it. In this sense, constexpr is viral and spreads confusion.
> >>  
> > 
> > I see constexpr primarily as a way to enable use of functions from
> > math.h in static initializers.
> >   
> 
> Maybe you are thinking in C++? C does not have compile time functions.
> 

I'd expect that in the next standard a wide subset of math functions
would be allowed in constexp.
In C++ they become constexpr in C++23. If no unexpected difficulties
shows up in C++ then C would be next.