Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Const-qualified function return type in C - is it a part of function type? Date: Sat, 22 Feb 2020 10:06:32 -0800 Organization: A noiseless patient Spider Lines: 52 Message-ID: <86wo8ebion.fsf@linuxsc.com> References: <45853431-d208-46e0-8945-78a42ed1a83e@googlegroups.com> <8736b2aeib.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="a1e79922b2c02e9149a52088916eaff2"; logging-data="18359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/I4ESbDtmxUZ6WdgRrxySGVzdkZ0s887s=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:+RTPUgc5BXulOQ3d/+vX8aEP6g8= sha1:jaUYiVr365ftb//NWfNeKQbRXc0= Xref: csiph.com comp.lang.c:150156 Ben Bacarisse writes: > Andrey Tarasevich writes: > > >> To avoid any further wastage of time on this irrelevant matter I >> hereby postulate one more time: the above quoted passage refers to >> qualifiers applied to the function type itself (which, BTW, is only >> possible through typedef names). > > And interesting detail, which I can't interpret... In all versions of > the C standard, there is a footnote attached to the paragraph > > "If the specification of an array type includes any type qualifiers, > the element type is so qualified, not the array type. If the > specification of a function type includes any type qualifiers, the > behavior is undefined." > > In C90, this footnote seems to be: > > 59) Both of these can only occur through the use of typedefs. > > By C99 it appears to have become > > 118) Both of these can occur through the use of typedefs. > > Why the change I wonder? I believe it was prompted by point 8 in this document, written by Doug Gwyn (dated 1997): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n762.htm > Is there a way to qualify a function or array > type without a typedef? I can't see one. I believe there is not. My guess is Doug was confused about what the footnoted sentence was meant to say, which in turn led him to misinterpret the footnote. > By the way, I hedge with "seems be" and "appears to have become" because > I don't have either standard, only pre-publication drafts. Maybe > someone with the actual text can verify? I believe the quotes you give match the published standards exactly, except that the footnotes have different numbers. Incidentally, when I say "I believe" it means I think the statement following "believe" is true, even though I may not be prepared to demonstrate its truth. This is in contrast to expressing an opinion, which is not about statements of fact and so not subject to being disproved.