Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #150164

Re: Const-qualified function return type in C - is it a part of function type?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Const-qualified function return type in C - is it a part of function type?
Date 2020-02-22 21:20 +0000
Organization A noiseless patient Spider
Message-ID <87o8tq71zo.fsf@bsb.me.uk> (permalink)
References (2 earlier) <r2ps1k$54e$1@dont-email.me> <cN%3G.128006$8Y7.26554@fx05.iad> <r2q8pd$7vj$1@dont-email.me> <8736b2aeib.fsf@bsb.me.uk> <86wo8ebion.fsf@linuxsc.com>

Show all headers | View raw


Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
>> Andrey Tarasevich <andreytarasevich@hotmail.com> writes:
>> <cut>
>>
>>> 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

Which says:

  8.  erroneous footnote 82

       8.1  the_problem

       Footnote 82 erroneously says that only through the use of
       typedefs can array or function type specifications include
       any type qualifiers.

       8.2  my_opinion

       I think this footnote was trying to be helpful, but
       incorrect footnotes are not helpful.

       8.3  my_proposal

       In 6.5.3 Type qualifiers, delete Footnote 82 and the
       reference to it.
 
>> 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.

What a strange state of affairs.  The original is helpful precisely
because of the one word that got removed.  And I can't see why n762
caused the vital word to be removed.

<cut>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Const-qualified function return type in C - is it a part of function type? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2020-02-21 14:35 -0800
  Const-qualified function return type in C - is it a part of function type? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-21 15:24 -0800
    Re: Const-qualified function return type in C - is it a part of function type? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2020-02-21 16:19 -0800
      Re: Const-qualified function return type in C - is it a part of function type? Richard Damon <Richard@Damon-Family.org> - 2020-02-21 20:50 -0500
        Re: Const-qualified function return type in C - is it a part of function type? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2020-02-21 19:56 -0800
          Re: Const-qualified function return type in C - is it a part of function type? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-22 14:22 +0000
            Re: Const-qualified function return type in C - is it a part of function type? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-02-22 10:06 -0800
              Re: Const-qualified function return type in C - is it a part of function type? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-22 21:20 +0000
                Re: Const-qualified function return type in C - is it a part of function type? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-02-24 20:58 -0800
            Re: Const-qualified function return type in C - is it a part of function type? luser droog <luser.droog@gmail.com> - 2020-02-22 19:24 -0800
              Re: Const-qualified function return type in C - is it a part of function type? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-23 03:52 +0000
                Re: Const-qualified function return type in C - is it a part of function type? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-02-24 21:06 -0800
      Re: Const-qualified function return type in C - is it a part of function type? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-02-21 21:21 -0800
  Re: Const-qualified function return type in C - is it a part of function type? Bonita Montero <Bonita.Montero@gmail.com> - 2020-02-22 07:51 +0100
    Re: Const-qualified function return type in C - is it a part of function type? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2020-02-22 05:00 -0800
      Re: Const-qualified function return type in C - is it a part of function type? Bonita Montero <Bonita.Montero@gmail.com> - 2020-02-22 16:23 +0100
      Re: Const-qualified function return type in C - is it a part of function type? Guillaume <message@bottle.org> - 2020-02-22 20:37 +0100
        Re: Const-qualified function return type in C - is it a part of function type? Bonita Montero <Bonita.Montero@gmail.com> - 2020-02-22 20:50 +0100
          Re: Const-qualified function return type in C - is it a part of function type? David Brown <david.brown@hesbynett.no> - 2020-02-23 07:29 +0100
            Re: Const-qualified function return type in C - is it a part of function type? Bonita Montero <Bonita.Montero@gmail.com> - 2020-02-23 08:57 +0100
  Re: Const-qualified function return type in C - is it a part of function type? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-02-22 09:53 -0800

csiph-web