Deutsch English Français Italiano |
<vbkjqk$201ms$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Top 10 most common hard skills listed on resumes... Date: Sun, 8 Sep 2024 17:36:36 +0100 Organization: A noiseless patient Spider Lines: 53 Message-ID: <vbkjqk$201ms$1@dont-email.me> References: <vab101$3er$1@reader1.panix.com> <vanq4h$3iieb$1@dont-email.me> <875xrkxlgo.fsf@bsb.me.uk> <vapitn$3u1ub$1@dont-email.me> <87o75bwlp8.fsf@bsb.me.uk> <vaps06$3vg8l$1@dont-email.me> <871q27weeh.fsf@bsb.me.uk> <20240829083200.195@kylheku.com> <87v7zjuyd8.fsf@bsb.me.uk> <20240829084851.962@kylheku.com> <87mskvuxe9.fsf@bsb.me.uk> <vaq9tu$1te8$1@dont-email.me> <vbci8r$1c9e8$1@paganini.bofh.team> <vbcs65$eabn$1@dont-email.me> <vbekut$1kd24$1@paganini.bofh.team> <vbepcb$q6p2$1@dont-email.me> <vbgb5q$1ruv8$1@paganini.bofh.team> <vbhbbb$1blt4$1@dont-email.me> <87tteqktr8.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 08 Sep 2024 18:36:36 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ad79b9a69b5377684053ea6685c7dbff"; logging-data="2098908"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tP3edqNn+1BaAUrs7l4uq" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:NrWl6mNux04BGL4ASm5jb+kVCo4= Content-Language: en-GB In-Reply-To: <87tteqktr8.fsf@bsb.me.uk> Bytes: 3116 On 08/09/2024 17:14, Ben Bacarisse wrote: > Bart <bc@freeuk.com> writes: > >> On 07/09/2024 02:44, Waldek Hebisch wrote: >>> Bart <bc@freeuk.com> wrote: >>>> On 06/09/2024 11:19, Waldek Hebisch wrote: >>>>> Bart <bc@freeuk.com> wrote: >> >>>> (You can balance it out by by requiring ASSIGN(&A, &B)!) >>> This would not work in general, as I wrote it, the following are >>> valid: >>> assign(&a, 42) >>> assign(&a, a + 1) >>> but the second argument has no address, so your variant would not >>> work. >> >> I believe that C's compound literals can give a reference to a+1: > > Is there no part of C you can't misrepresent? Is nothing I write that you will take issue with? > >> #include <stdio.h> >> >> void assign(int* lhs, int* rhs) { >> *lhs = *rhs; >> } >> >> int main(void) { >> int a=20; >> >> assign(&a, &(int){a+1}); > > This is simply an anonymous object. You could have used a named object > and it wold not have been any further from being a "reference to a+1". I suggested a 'assign()' function could have balanced parameters by requiring: asssign(&A, &B); Someone objects that you can't in general apply & to arbitrary, unnamed, transient, intermediate values such as 'a + 1'. I showed how you could do that using anonymous compound literals which avoids having to create an explicit named temporary which in standard C would need to be outside of that assignment call. But you apparently have a problem it. Or more likely you have a problem with me.