Deutsch   English   Français   Italiano  
<vebpo5$3olu3$1@dont-email.me>

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

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.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: Fri, 11 Oct 2024 15:11:17 -0300
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vebpo5$3olu3$1@dont-email.me>
References: <veb5fi$3ll7j$1@dont-email.me>
 <vebp8r$3ok6d$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Oct 2024 20:11:17 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="08f2e050f8383961c465679859cc030e";
	logging-data="3954627"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX188r+39tEax+30Skhsoa+ITGdUfDiFovF4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t2WEGRo6zgvmNDQq+HU2sW4EWC4=
In-Reply-To: <vebp8r$3ok6d$1@raubtier-asyl.eternal-september.org>
Content-Language: en-GB
Bytes: 2414

Em 10/11/2024 3:03 PM, Bonita Montero escreveu:
> Am 11.10.2024 um 14:25 schrieb Thiago Adams:
> 
>> I think constexpr keyword is unnecessary.
>> Anything you do with it could/should be done with const.
>> Even without const , one object like (struct point){.x=1, .y=0} is a 
>> constant in my view.
>> So, for instance, no need for (constexpr struct point){.x=1, .y=0} here.
>> The VLA could have been the motivation for a new keyword, but I don’t 
>> think it matters.
>> On the other hand, (static struct point){.x=1, .y=0} makes sense.
>> If constexpr were "no-storage" I think it would make sense but it is not.
> 
> const doesn't replace constexpr. constexpr is when you want to
> assure that the variable is compile-time generated. You can't
> enforse this constraint with const.

What I am saying is make const do that. No need for a new keyword.


> But I find all these attempts to modernize C hopeless. C wants
> to remain a minimalist language and is therefore light years
> behind other languages. For me, C is intended to be used when
> a more advanced lanugage is not available.

constant expression make sense in C. It is not new, it is very old.
The difference now is the extension and this will not make the language 
more complicated but more coherent.