[comp.lang.c] ANSI function prototypes

Schauble@MIT-Multics.arpa (Paul Schauble) (07/25/87)

Does the ANSI standard allow for nested prototypes, i.e.

    int fa (int, int (*)(char *, int));
  or
    int (*fa(char *)) (int, int);

  Paul 
  Schauble at MIT-Multics.ARPA

gardner@prls.UUCP (Robert Gardner) (07/27/87)

(My only experience with function prototypes is with Lightspeed C.)
Does ANSI provide any way of prototyping optional parameters so
that type checking is still done on the optional parameter(s). 
I.e. can you somehow declare
      int foo(int,.../* but if present it should be one int */);

Also, it bothers me that parameters (i.e. variable args) can
be passed differently depending on whether or not a prototype is
present.  I can just see people spending hours trying to track down
a bug because they forgot to include the prototype. (Or am I the
only one who has an imperfect memory while programming?:-)

Robert Gardner

bright@dataio.Data-IO.COM (Walter Bright) (07/27/87)

In article <8469@brl-adm.ARPA> Schauble@MIT-Multics.arpa (Paul Schauble) writes:
<Does the ANSI standard allow for nested prototypes, i.e.
<    int fa (int, int (*)(char *, int));
<  or
<    int (*fa(char *)) (int, int);

Yes.