Deutsch English Français Italiano |
<vbo3bn$2igdn$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: 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: Tue, 10 Sep 2024 01:20:08 +0100 Organization: A noiseless patient Spider Lines: 64 Message-ID: <vbo3bn$2igdn$2@dont-email.me> References: <vab101$3er$1@reader1.panix.com> <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> <vbj6ii$1q6mh$1@dont-email.me> <20240908115827.00007521@yahoo.com> <vbju6l$1sqao$2@dont-email.me> <87zfoikve1.fsf@bsb.me.uk> <vbkka9$201ms$2@dont-email.me> <vbnv43$2igdn$1@dont-email.me> <87mskg1j13.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 10 Sep 2024 02:20:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="dcf5d3c489b4c68fb3a29f50d34b534a"; logging-data="2703799"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oRJobHMFqfg7OJfbZ98MA" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Ek9XzgpwZld4VxN+UeuaGElbzLg= In-Reply-To: <87mskg1j13.fsf@nosuchdomain.example.com> Content-Language: en-GB On 10/09/2024 00:53, Keith Thompson wrote: > Bart <bc@freeuk.com> writes: >> On 08/09/2024 17:44, Bart wrote: >>> On 08/09/2024 16:39, Ben Bacarisse wrote: >>>> Bart <bc@freeuk.com> writes: >>>> >>>>> In language like C, the LHS of an assignment is one of four categories: >>>>> >>>>> A = Y; // name >>>>> *X = Y; // pointer >>>>> X[i] = Y; // index >>>>> X.m = Y; // member select >>>> >>>> I can think of three others. There may be more. >>> OK, so what are they? >> >> TM: >>> Yes, very good. I count four or five, depending on what >> differences count as different. >> >> I guess nobody is going to say what those extra categories are, are they? > > The LHS of an assignment must be a modifiable lvalue. Searching for the > word "lvalue" in the standard's section on expressions yields several > forms not listed above: > > - A parenthesized lvalue: > (A) = Y; > > - A generic selection whose result expression is an lvalue: > _Generic(0, int: A) = Y; > Not sure why you'd do this. > > - X->m, where X is a pointer (you might think of that as the same > category as X.m, but the standard doesn't define the -> operator in > terms of the . operator) > > - A compound literal: > int n; > (int){n} = 42; > > This assigns a value to a temporary object which is immediately > discarded. I can't think of a valid use for this. > OK, thanks for the prompt response. You listed 4 examples; the 4th one I had no idea about (I don't support compound literals anyway). The first 3, I have doubts as to whether they warrant their own categories. The first two just end up doing an assignment to A (parentheses are no-ops in terms like these anyway). While the X->m term is exactly equivalent to (*X).m. I put these three through my compiler and they produced the same AST as A = Y or *(X).m. So I might call them curiosities rather than practical categories that offer new possibilities. For example, one of mine (I have several more actual ones) is multiple assignment: (a, b) = (c, d).