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


Groups > comp.lang.c > #22232

Re: Empty function parameter list

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Empty function parameter list
Date Wed, 13 Jun 2012 18:50:13 -0400
Organization A noiseless patient Spider
Lines 30
Message-ID <4FD91925.8070407@verizon.net> (permalink)
References <e3aacc3b-f17b-4da8-a1e6-f54b3273ecf0@x21g2000vbc.googlegroups.com> <jrb4lg$j06$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
Injection-Info mx04.eternal-september.org; posting-host="2P71cupDoazVVolqpw1jrw"; logging-data="23380"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/I/UshrNmvNobXabsoBIYEkT21cXqyCyY="
User-Agent Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111220 Thunderbird/9.0
In-Reply-To <jrb4lg$j06$1@dont-email.me>
Cancel-Lock sha1:dwA6RXvEG7qfOugCGCJ0jfakvjw=
Xref csiph.com comp.lang.c:22232

Show key headers only | View raw


On 06/13/2012 06:36 PM, Eric Sosman wrote:
> On 6/13/2012 5:48 PM, Maxim Fomin wrote:
...
>> #include <stdio.h>
>>
>> int (*funcptr)();
>>
>> int foo(int x)
>> {
>> 	return x;
>> }
>>
>> int main()
>> {
>> 	funcptr = foo;
> 
>      I expected a diagnostic here because the parameter lists `()'
> and `(int x)' are different, making the types of `funcptr' and
> `foo' different.  But "different" and "incompatible" are not quite
> the same, and I'm not 100% sure about whether this assignment is
> legal or not.  Let's leave it to the language lawyers, okay?

I answered the rest of his message, but missed his original question.

A function type with an unspecified number of arguments is compatible
with one that has a parameter type list, which is why that is not a
constraint violation. The requirement in 6.7.6.3p15, that both function
types must have matching parameter lists, only applies "if both are
present". If either parameter list is not present, then the parameter
list that is present doesn't interfere with compatibility.

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


Thread

Empty function parameter list Maxim Fomin <maxim@maxim-fomin.ru> - 2012-06-13 14:48 -0700
  Re: Empty function parameter list Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-13 18:36 -0400
    Re: Empty function parameter list James Kuyper <jameskuyper@verizon.net> - 2012-06-13 18:50 -0400
      Re: Empty function parameter list Maxim Fomin <maxim@maxim-fomin.ru> - 2012-06-15 02:08 -0700
        Re: Empty function parameter list Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-15 11:30 +0100
  Re: Empty function parameter list James Kuyper <jameskuyper@verizon.net> - 2012-06-13 18:38 -0400
  Re: Empty function parameter list Dinesh Kalal <mr.dineshkalal@gmail.com> - 2012-06-15 01:35 -0700
    Re: Empty function parameter list James Kuyper <jameskuyper@verizon.net> - 2012-06-15 08:22 -0400

csiph-web