Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Bart Newsgroups: comp.lang.c Subject: Re: Top 10 most common hard skills listed on resumes... Date: Thu, 12 Sep 2024 20:54:54 +0100 Organization: A noiseless patient Spider Lines: 84 Message-ID: References: <87v7zjuyd8.fsf@bsb.me.uk> <20240829084851.962@kylheku.com> <87mskvuxe9.fsf@bsb.me.uk> <87tteqktr8.fsf@bsb.me.uk> <87ttenk2nq.fsf@bsb.me.uk> <87ikv0y864.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 12 Sep 2024 21:54:53 +0200 (CEST) Injection-Info: dont-email.me; posting-host="3a3e703b62fd17d38a4df729837e6247"; logging-data="422702"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kk9HFaJEMt8MP3nHorJ66" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:PUmgVkCRLEzX648NgSkP43mCs1E= Content-Language: en-GB In-Reply-To: <87ikv0y864.fsf@nosuchdomain.example.com> Bytes: 4811 On 12/09/2024 20:38, Keith Thompson wrote: > Bart writes: > [...] >> It's not that complicated, not with C anyway. >> >> Because in C, if you take the 3-4 categories of LHS in assignments >> (ignore the esoteric ones, and [] and . are really the same), there is >> only one top-level lvalue node to consider. > > I agree, there's only one thing to consider. The LHS of an > assignment is a modifiable lvalue. > > We've spent a lot of time arguing about how any "categories" there > are for the LHS of an assignment. If I recall correctly, the whole > thing started when you stated that "the LHS of an assignment is > one of four categories", leading to a debate about whether four > is the correct number. > > Enumerating the kinds of expressions that can be modifiable > lvalues is interesting, I suppose, but are A and (A) in different > "categories"? Is it important to count generic selections and > compound literals? > > Who cares, and why? If you go back far enough, someone was questioning the use of a 2-way selection (what in C would be expressed using ?:) on the left of an assignment, in an example from another language. So my set of categories were in the context of what /was/ allowed in C on the left of an assignment. People made too much of it. >> And yet, I was doing that in the 1980s on my toy compilers. So that's >> not that hard either. > > Ok, it's not that hard to implement things that are not valid C. And my comments were in reply to this from WH: > But it creates troubles, process of changing > subexpression with read references into write access is more > complicated than replacing read instruction by write instruction. > One, they need to recognize things which are invalid. This suggests a complexity that does not really exist, certainly not for C with its simple LHSs, and I said that it's not that hard even with more elaborate languages. So your reply is taking my remark of contest. Or were you just trying to write something clever? According to that, any entire language X would be easy to implement because it's not valid C? >> What exactly /is/ lvalue conversion? What is converted to what? > > This is specified in the C standard (6.3.2.1p2 in C11, 6.3.3.1p2 > in C23 drafts). I suggest you read it. > > An lvalue (an expression that designates an object) is converted > to the value stored in the designated object. This conversion > (adjustment) does not occur on the LHS of an assignment or in > several other contexts. > > It might have been clearer to say that the expression is adjusted > from an expression that designates an object (an lvalue) to an > expression that yields the value of that object (not an lvalue) > > Note that this is not a run-time conversion, Well quite. WH was trying to make it out it's a big deal, but it's usually a no-op (ie. nothing needs to be done in an actual compiler). > like a conversion of an > integer value to a floating-point value. No, there an actual conversion is needed, usually. (Maybe the implementation language only stores numeric constants as floats, so only the type tag changes.)