Re: const and K&R C - was Re: AW: A: a new bug to old plain C
J Decker via Gcc-help <[email protected]>
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <CAA2GJqXi22qw81zHKfcGgzpCvbe0ZK392+0QyRrkucdOpdsQag@mail.gmail.com> |
What did I know, I was just a kid... this is what I'm referring to of course.... https://www.cs.sfu.ca/~ashriram/Courses/CS295/assets/books/C_Book_2nd.pdf first mentioned on page 39... volatile is there too. A.4.4 Type Qualifiers An object's type may have additional qualifiers. Declaring an object const announces that its value will not be changed; declaring it volatile announces that it has special properties relevant to optimization. Neither qualifier affects the range of values or arithmetic properties of the object. Qualifiers are discussed in Par.A.8.2. A7.17 ... or both operands are pointers to functions or *objects whose types *are the same except for the possible absence of *const* or *volatile *in the right operand. Though that says 'THE possible presence' which probably infers a single const ... rather than something like 'except for absent const or volatile operators in the right operand' (char const*const*const*) = (char***) On Fri, Dec 5, 2025 at 10:19 PM Andrew C Aitchison via Gcc-help < [email protected]> wrote: > On Fri, 5 Dec 2025, J Decker via Gcc-help wrote: > > > It was my understanding of the C standard from K&R days, > > was that pointers could inherit const, but not lose const... > > My recollection is that there was no *const* in K&R C ? > > -- > Andrew C. Aitchison Kendal, UK > [email protected] >