bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] Re: K&R prototypes in ftp/extern.h


From: Guillem Jover
Subject: Re: [bug-inetutils] Re: K&R prototypes in ftp/extern.h
Date: Fri, 10 Dec 2010 07:49:55 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi!

On Sun, 2010-11-28 at 13:51:27 -0500, Alfred M. Szmidt wrote:
>    >> > --- a/ftp/extern.h
>    >> > +++ b/ftp/extern.h
>    >> > @@ -119,7 +119,7 @@ void reset (int, char **);
>    >> >  void restart (int, char **);
>    >> >  void rmthelp (int, char **);
>    >> >  void rmtstatus (int, char **);
>    >> 
>    >> Any reason K&R prototypes are used here?  Should we change this?
>    >
>    > Maybe I'm missing something, but how are those K&R prototypes?
>    > K&R style lack function arguments, these only lack argument names
>    > which is fine.
> 
>    Duh, sorry.  So these are valid C89 and/or C99 prototypes?  That
>    would explain why I didn't find a gcc parameter to catch them...
> 
> Back in the day you'd skip the name of a variable in the prototype,
> hence it being called K&Rism.

Well, K&R didn't really have prototypes to start with, only forward
declarations, needed when the function did return non-ints. Skipping
the variable names in declarations is just fine even with latest C
revisions. OTOH K&R style declarations lacked any kind of argument,
as in:

  short foo ();

> It is valid C though, be it C90 or C99;

In some cases it will actually not be valid C99, given that C99 does
not assume int implicitly anymore (even if the compilers might). And
even on the valid cases it does not mean it should not be considered
highly deprecated, though. It also does not make it possible for the
compiler to do type checks.

> much like it is still valid to write:

> int foo (int, char)
>   int a, char b;
> {
> ...
> }

This is not valid C. The equivalent K&R style definition could be
something like:

  foo (a, b)
    char b;
  {
    ...
  }

But enough nitpicking, I guess. :)

regards,
guillem



reply via email to

[Prev in Thread] Current Thread [Next in Thread]