Deutsch   English   Français   Italiano  
<vndmsc$2fau5$1@dont-email.me>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Results of survey re. a new array size operator
Date: Wed, 29 Jan 2025 18:01:00 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vndmsc$2fau5$1@dont-email.me>
References: <87a5bgsnql.fsf@gmail.com> <87ldut38zt.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Jan 2025 18:01:01 +0100 (CET)
Injection-Info: dont-email.me; posting-host="e6bdc1d7ae4106e5dccd34132519530a";
	logging-data="2599877"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Rva0yQRpgjloCBThZZFoEivPAD0QcMic="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:H1G3ZrHKVgdOeJPX/w+9bextMQc=
Content-Language: en-GB
In-Reply-To: <87ldut38zt.fsf@bsb.me.uk>
Bytes: 2202

On 29/01/2025 17:00, Ben Bacarisse wrote:
> Alexis <flexibeast@gmail.com> writes:
> 
>> JeanHeyd Meneide, a Project Editor for WG14, has just posted the results
>> of a survey re. the preferred form of a new array size operator:
>>
>> -- https://thephd.dev/the-big-array-size-survey-for-c-results
> 
> Curious.  The top objection to the usual macro solution is given as:
> 
>    * double-evaluation of e.g. getting the size of the 1-d part of a 2-d
>      array int meow[3][4]; /* ... */ SIZE_KEYWORD(meow[first_idx()]);
> 
> Does the author not know that there is no evaluation of the operands of
> sizeof in this example?
> 

6.5.3.4p2 :

"""
If the type of the operand is a variable length array type, the operand 
is evaluated; otherwise, the operand is not evaluated and the result is 
an integer constant.
"""

I don't know if that is the source of the double-evaluation concern 
here, but it is certainly a situation in which sizeof /does/ evaluate 
its operand.

> His "About" pages says "Project Editor for ISO/IEC JTC1 SC22 WG14 -
> Programming Languages, C".
>