Deutsch English Français Italiano |
<87wmjjz33z.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: Tue, 10 Sep 2024 13:05:20 -0700 Organization: None to speak of Lines: 50 Message-ID: <87wmjjz33z.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> <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> <87zfofk32t.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 10 Sep 2024 22:05:21 +0200 (CEST) Injection-Info: dont-email.me; posting-host="29df7bbfeaa4d6ddeb7fdca1349b4e93"; logging-data="3288061"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PKZBAQZkujhBh95l1K3VM" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:JDFo3QWpHOiIjdt1+Bu+utQ+TmQ= sha1:pGtRTVwEmrEdVoY23hlHKnp8qpE= Bytes: 3345 Ben Bacarisse <ben@bsb.me.uk> writes: > Bart <bc@freeuk.com> writes: >> On 08/09/2024 17:44, Bart wrote: >>> On 08/09/2024 16:39, Ben Bacarisse wrote: ....] >>>> I can think of at least one expression form for X that contradicts this >>>> claim. >>> Example? >> >> Nothing here either. > > f().m where f returns a struct. "A postfix expression followed by the . operator and an identifier designates a member of a structure or union object. The value is that of the named member, and is an lvalue if the first expression is an lvalue." A function call is not an lvalue, so f().m is not an lvalue. But if the member is an array, then f().a[i] is an lvalue referring to an object with automatic storage duration and *temporary lifetime* (a concept introduced in C11). But modifying such an object has undefined behavior. (The array itself can't be on the LHS of an assignment.) For example: struct foo { int arr[10]; }; struct foo func(void) { struct foo result = { 0 }; return result; } int main(void) { func().arr[0] = 42; // undefined behavior } A function call is not an lvalue (it yields a value but does not designate an object), but if the result is a struct or union that has a member of array type then that array needs to be treated as an lvalue for indexing to work. (Prior to C11, the standard implicitly assumed that an expression of array type can only be an lvalue. This left a hole in the special case of an array member of a struct or union returned from a function. C11 invented "temporary lifetime" to deal with this.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */