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: Sun, 06 Feb 2022 02:01:56 -0800 Organization: A noiseless patient Spider Lines: 27 Message-ID: <861r0gl3e3.fsf@linuxsc.com> References: <87k0easj5d.fsf@bsb.me.uk> <865yptlpgf.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="a80c60510ddf69c3dc6a890da3a37a42"; logging-data="31089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oHOivxxaIjgxqv3MfAd4f0AnFeykYaKQ=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:Hsg4Z8+diKiHlPJ/EVuepPUnIlg= sha1:vTHDts/WSxm4w/7VPzbLqtuHA3Q= Xref: csiph.com comp.lang.c++:82930 Bonita Montero writes: > Am 06.02.2022 um 01:42 schrieb red floyd: > >> On 2/5/2022 10:51 AM, Bonita Montero wrote: >> >>>> On 2/4/2022 11:53 PM, Tim Rentsch wrote: >>>> >>>>> char *ep = (&result)[1]; >>>> >>>> Am 05.02.2022 um 19:10 schrieb red floyd: >>>> Why the oddly unreadable initialization of ep? Why not just >>>> >>>> char *ep = result + sizeof(result)? >>> >>> I also consider (&result)[1] as the more elegant way. >> >> To be honest, I don't give a damn about your opinion. > > Your solution works only with char-arrays. > Tims solution works with all arrays. I don't claim any credit for this idiom. I first learned the idiom some time ago from a posting by Ben Bacarisse, and my posting upthread here was simply copying the usage from his earlier posting (which was in fact the posting to which I was responding).