Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: C++20 concepts rocks
Date: Mon, 14 Feb 2022 23:55:17 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <864k50imxm.fsf@linuxsc.com>
References: <87k0easj5d.fsf@bsb.me.uk> <865yptlpgf.fsf@linuxsc.com> <87mtj4qd0h.fsf@bsb.me.uk> <86fsovkdjw.fsf@linuxsc.com> <877da7r7ap.fsf@bsb.me.uk> <86bkzjjs3c.fsf@linuxsc.com> <87k0e6q4j8.fsf@bsb.me.uk> <8635kukb17.fsf@linuxsc.com> <878rumptie.fsf@bsb.me.uk> <86leymiga7.fsf@linuxsc.com> <877da3n2au.fsf@bsb.me.uk> <86czjvi97y.fsf@linuxsc.com> <87czjulvm9.fsf@bsb.me.uk> <868ruhikqf.fsf@linuxsc.com> <87mtixj6mb.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="2ced22d51f2768d5f155d420840b05f4"; logging-data="17944"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/s0oa1y249l2MbgshZfQvpxoBUOlzHcCU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:aoF6AmSLCEJmzJAQA3o5zDahEYQ= sha1:h6vCDfvwsMdV70RwC9RYu5cEgEs=
Xref: csiph.com comp.lang.c++:83001
Ben Bacarisse writes:
> Tim Rentsch writes:
[edited for brevity]
>> If we have this code fragment
>>
>> int foo[10][20];
>> extern void set_elements( int *, size_t, int )
>>
>> set_elements( (int*) &foo, 10*20, -1 );
>>
>> an argument could be made that set_elements() cannot use pointer
>> arithmetic (including that implied by use of []) on its first
>> argument other than to access between foo[0][0] and foo[0][19] (or
>> to construct a pointer to foo[0][20]). [...]
>
> [...] It's what direct additions and subtractions are permitted
> for any given pointer that I no longer feel sure about. Your "a
> case could be made" suggests you are not entirely sure either,
> though it does suggest you consider that case is a stretch.
The implied question here has a somewhat longish answer. I'll
get to it when I can. Also, as it seems we have drifted rather
far from C++, comp.std.c is I think a better place to continue.