Deutsch English Français Italiano |
<vegh32$mi48$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c Subject: Re: constexpr keyword is unnecessary Date: Sun, 13 Oct 2024 15:14:32 +0200 Organization: A noiseless patient Spider Lines: 40 Message-ID: <vegh32$mi48$1@raubtier-asyl.eternal-september.org> 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> <vegg4q$mdj0$1@raubtier-asyl.eternal-september.org> <veggq8$mbh9$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 13 Oct 2024 15:14:10 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="c70044d56ce67ca2d81b0f66bfd60be6"; logging-data="739464"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nV2OkBtkqxn5Miv2i3zcRsXcV5QEzowU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:NIlbvDK/Ohho15nom4dTYB22Jnc= Content-Language: de-DE In-Reply-To: <veggq8$mbh9$1@dont-email.me> Bytes: 2647 Am 13.10.2024 um 15:09 schrieb Thiago Adams: > Em 10/13/2024 9:58 AM, Bonita Montero escreveu: >> Am 13.10.2024 um 14:38 schrieb Thiago Adams: >>> 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. >> >> constexpr doesn't hurt. > > > It spreads confusion, ... It can be understood in 10s. > ... and makes code incompatible with previous versions of C "for free". New improvements are always incompatible and there are mature C23 compilers.