Deutsch English Français Italiano |
<vecuhe$1o44$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!news.mixmin.net!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: Sat, 12 Oct 2024 06:39:30 +0200 Organization: A noiseless patient Spider Lines: 34 Message-ID: <vecuhe$1o44$1@raubtier-asyl.eternal-september.org> References: <veb5fi$3ll7j$1@dont-email.me> <vebp8r$3ok6d$1@raubtier-asyl.eternal-september.org> <vebpo5$3olu3$1@dont-email.me> <vebtjp$3p9sm$1@raubtier-asyl.eternal-september.org> <vebubq$3p8oj$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 12 Oct 2024 06:39:10 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="2e9c154056f6d626eb2d18ab0ff00436"; logging-data="57476"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sEsDZcR7NbBumXU/xjs1htVvJkfpuVcU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:ejuVmshSUUto4OHhDxSRKHeQvbE= In-Reply-To: <vebubq$3p8oj$1@dont-email.me> Content-Language: de-DE Bytes: 2389 Am 11.10.2024 um 21:30 schrieb Thiago Adams: > Em 10/11/2024 4:17 PM, Bonita Montero escreveu: >> Am 11.10.2024 um 20:11 schrieb Thiago Adams: >> >> >> >>> constant expression make sense in C. It is not new, it is very old. >> >> const has a definition and it allows non compile-time evaluated >> variables. > > yes. but? With constexpr you could enforce that the expression you assign is compile-time evaluated. That's while constexpr would make sense. > What I am suggesting again is remove the keyword constexpr. make const > do that. > > Just to remember C++ was already like that before constexpr. In c++ > const could be used as constant expressions. > What C++ could not ensure is that global variables would have a compile > time initialization. > In C all global variables are initialized in compile time. > For local variables like... > > const int i = ... ; > the compiler must evaluate the initialization expression if it can be > computed in compile time then i is "constexpr" does not matter if it > have or not the constexpr keyword. > > >