| Deutsch English Français Italiano |
|
<20241201184717.000018a7@yahoo.com> 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: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: question about linker Date: Sun, 1 Dec 2024 18:47:17 +0200 Organization: A noiseless patient Spider Lines: 70 Message-ID: <20241201184717.000018a7@yahoo.com> References: <vi54e9$3ie0o$1@dont-email.me> <vi6sb1$148h7$1@paganini.bofh.team> <vi6uaj$3ve13$2@dont-email.me> <87plmfu2ub.fsf@nosuchdomain.example.com> <vi9jk4$gse4$1@dont-email.me> <vi9kng$gn4c$1@dont-email.me> <87frnbt9jn.fsf@nosuchdomain.example.com> <viaqh0$nm7q$1@dont-email.me> <877c8nt255.fsf@nosuchdomain.example.com> <viasv4$nm7q$2@dont-email.me> <vibr1l$vvjf$1@dont-email.me> <vic73f$1205f$1@dont-email.me> <20241129142810.00007920@yahoo.com> <86ser8obe1.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Sun, 01 Dec 2024 17:46:27 +0100 (CET) Injection-Info: dont-email.me; posting-host="af322d51ba249ca3f8010405aab9c2b4"; logging-data="2470937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Kk2EFLXEnpdYktkDvbdR++gunFdILTrI=" Cancel-Lock: sha1:MVTANJVT+pW8WrdM3X26Yvl9vqw= X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32) Bytes: 4463 On Sat, 30 Nov 2024 09:54:30 -0800 Tim Rentsch <tr.17687@z991.linuxsc.com> wrote: > Michael S <already5chosen@yahoo.com> writes: > > > IMHO, any way to mix more than one 'modifier' (not in C standard > > meaning of the word, but in more general meaning) is potentially > > confusing. It does not matter whether modifier is 'const' or '*' > > or [] or (). > > It surprises me that you would say this. Certainly there are type > forms that might be difficult to absorb (e.g., 'float *********') > but that doesn't mean they are necessarily confusing. There are two > obvious ways to write type forms that are easy to decode. One way > is to write any derivings right-to-left: > > [] * (double,double) * float > > which can be read directly as "array of pointer to function that > returns a pointer to float", and the other way is simply the reversal > of that: > > float * (double,double) * [] > > which can be read right-to-left the same way. The constructors for > derived types (pointer, array, function) act like nouns. Qualifiers > such as const or volatile act like adjectives and always go to the > left of the noun they modify, so for example > > [] volatile* float > > is an array of volatile pointer to float, or in the other ordering > > float volatile* [] > > which is simply a reversal of noun phrases, with any modifying > adjectives staying on the left side of the noun they modify. > That's nice. It's a pity it will never be adapted in C. > The syntax used in C is harder to read for two reasons: one, the > ordering of derivations is both left-to-right and right-to-left, > depending on what derivation is being applied; and two, any > identifier being declared goes in the middle of the type rather > than at one of the ends. Both of those confusions can be removed > simply by using a consistent ordering, either left-to-right or > right-to-left (with qualifying adjectives always on the left of > the noun they modify). > > Note that both of the consistent orderings correspond directly to a > natural English wording, which accounts for them being easier to > comprehend than C-style type forms. (I conjecture that some foreign > languages might not have that property, but since I am for the most > part ignorant of essentially all natural languages other than > English I have no more to say about that.) As you can see, in a reply to my post Bart already suggested that the problematic part is not a chain itself, but mixture of terms that has to be read left-to-right with those has to be read right-to-left. You can also see that I already mostly agreed with him. Mostly rather than completely, because I think that when a single declaration has more than half a dozen terms it is difficult to understand even when it does not change direction in the middle. But my main disagreement with Bart was orthogonal to this discussion. It was about 'const' not being any harder to understand than other "right-to-left' type modifiers.