Deutsch English Français Italiano |
<87v7z62bt5.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: Top 10 most common hard skills listed on resumes... Date: Sun, 08 Sep 2024 12:19:18 -0700 Organization: None to speak of Lines: 61 Message-ID: <87v7z62bt5.fsf@nosuchdomain.example.com> References: <vab101$3er$1@reader1.panix.com> <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> <vbjtmi$1sqao$1@dont-email.me> <vbkr15$27l2o$2@paganini.bofh.team> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sun, 08 Sep 2024 21:19:20 +0200 (CEST) Injection-Info: dont-email.me; posting-host="cc0e421bd7ae7ddfd4a32af9b891a7a5"; logging-data="2131817"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xB4QSJAUarCQ3E93+w0c1" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:fiKnx3IEW+JMpzwkHxBdU8kZ/lw= sha1:o+NbC1faXD1uL4USKusakk7VD3A= Bytes: 3453 Waldek Hebisch <antispam@fricas.org> writes: > Bart <bc@freeuk.com> wrote: >> >> But the feature (using them in lvalue contexts) was rarely used. >> >> (** This is: >> >> (a, b, c) = 0; >> >> in C, which is illegal. But put in explicit pointers, and it's suddenly >> fine: >> >> *(a, b, &c) = 0; >> >> So why can't the compiler do that?) A C compiler doesn't do that because the language doesn't allow it. An expression whose top-level operator is a comma operator is not an lvalue in C, even if the operands are lvalues. It could have been, but it isn't. > The second really is > > (a, b, c = 0); > > I do not know what you expect writing '(a, b, c) = 0', but the above > C meaning probably is not what you want. I think Bart was talking about a hypothetical feature that allows comma expressions to be lvalues. The comma operator evaluates both its operands and yields the value of the right operand. So for example: (a, b) = 0; which is a constraint violation in current C, the LHS (a, b) would be treated as an lvalue that discards a and designates b, which then becomes the target of the assignment. It's not an insane idea, and it wouldn't be difficult to specify its semantics consistently. In fact C++ supports conditional and comma expressions as lvalues; `(a, b) = 0;` is a constraint violation in C, but valid in C++. I'm not sure how useful it is. > I use language that allows: > > (a, b, c) := (b, c, a); > > that is if there are 3 things on left hand side, then there must > be 3 things on the right hand side. That's not a comma operator, and I don't think it's relevant to what Bart is talking about. The comma symbol is used in a lot of different contexts. Bart, please jump in if I've misunderstood what you meant. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */