Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #163258
| From | Meredith Montgomery <mmontgomery@levado.to> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: on the order of the const-keyword |
| Date | 2021-10-29 20:03 -0300 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <86sfwje8mt.fsf@levado.to> (permalink) |
| References | (2 earlier) <slgigl$pss$1@dont-email.me> <slh0j8$26m$1@dont-email.me> <slh4vq$neb$1@dont-email.me> <slh7j5$ohl$1@dont-email.me> <slhspd$1rjm$1@gioia.aioe.org> |
Manfred <noname@add.invalid> writes: > On 10/29/2021 6:30 PM, David Brown wrote: >> On 29/10/2021 17:45, Bart wrote: >>> On 29/10/2021 15:31, David Brown wrote: >>>> On 29/10/2021 12:30, Bart wrote: >>>>> On 29/10/2021 09:03, David Brown wrote: >>>>>> On 28/10/2021 17:50, Meredith Montgomery wrote: >>>>>>> These seem legal declarations in C: >>>>>>> >>>>>>> const char msg[9] = "warming:"; >>>>>>> char const msg[9] = "warming:"; >>>>>>> >>>>>>> What's the difference between them? [...] >>> Your advice to read declarations from right to left I think was not >>> helpful either, being incorrect except in the simplest cases involving >>> only * modifiers and associated consts. >>> >> In other words, it applies fine to the large majority of >> declarations. You can add "inside out" to it to cover more cases. I >> understand that this is a simplification - but that's what people >> need at the start. > > Not sure about that, at least not this kind of simplification. I > think Bart made a good point, in noting that the right-to-left rule > does not work well in some case, notably with pointers to arrays, > which is something to be considered at any level of C knowledge. So, > as a first a simplification that can be wrong with some declaration > that, although unfriendly to the novice, can actually be found in real > code, runs the risk of being more confusing than helpful for the less > experienced. > > The second problem is that when such less experienced happens to read > the standard's definition (which will happen at some point for any > serious programmer), they will have the problem that the > simplification is nowhere near the wording of the standard, so again > risk of more confusion than help. > > From all the answers that have been given here, I think that one of > James Kuypers' (the one citing the standard's distinction between > 'declaration-specifiers' and 'init-declarator-list') is the most > useful, because /that/ is how declarations work in C, plain and > simple, even if their description is not that simple. It's really education we're talking about here. Education is not quite a scientific area; it's a philosophical one in the Bertrand Russell sense of philosophy: if there were a clear answer to how to do it, it'd be called science. (See the first few pages of his ``A History of Western Philosophy''.) Because we don't know what is the right approach, we should more or less provide them all. More or less, of course. And it is a very good idea to present to students your opinion such as --- this is the right approach **for sure** and there are other silly approaches too because some people are too blind to see. Consider this very thread. A novice is looking at this and getting a clear picture of the cloud that education in this area is. (It's like that in every area, actually.) That's (evidently) a fact --- locally at the very least. One of the great friends of students is moving-ahead. You realize you've got an education when you look back, but to look back you must move ahead. So it is a good idea to come up with a modus operandi, even if it's broken. This is an important piece of the scientific method: come up with a hypothesis and stress it until it breaks. But, of course, if the student can't understand the hypothesis (because it's too complex), then it might be a useless one. There are multiple levels of students --- there are researcher-students, students-students, children-students.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-28 12:50 -0300
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 17:25 +0100
Re: on the order of the const-keyword "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-10-28 10:10 -0700
Re: on the order of the const-keyword Guillaume <message@bottle.org> - 2021-10-28 20:40 +0200
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:07 -0300
Re: on the order of the const-keyword James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-29 00:48 -0400
Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 12:56 -0700
Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 13:18 -0700
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 21:35 +0100
Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 13:57 -0700
Re: on the order of the const-keyword Thiago Adams <thiago.adams@gmail.com> - 2021-10-28 14:07 -0700
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-28 22:54 +0100
Re: on the order of the const-keyword Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-28 15:37 -0700
Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-29 00:02 +0100
Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-28 22:10 +0100
Re: on the order of the const-keyword Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-28 15:13 -0700
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:40 -0300
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-28 23:48 -0300
Re: on the order of the const-keyword James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-28 13:04 -0400
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 00:34 -0300
Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 10:03 +0200
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 11:30 +0100
Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 16:31 +0200
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 16:45 +0100
Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 18:30 +0200
Re: on the order of the const-keyword Manfred <noname@add.invalid> - 2021-10-30 00:32 +0200
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 20:03 -0300
Re: on the order of the const-keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-30 01:10 +0100
Re: on the order of the const-keyword Bart <bc@freeuk.com> - 2021-10-29 23:51 +0100
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 12:22 -0300
Re: on the order of the const-keyword David Brown <david.brown@hesbynett.no> - 2021-10-29 18:34 +0200
Re: on the order of the const-keyword Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 17:04 -0300
csiph-web