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


Groups > comp.lang.c > #149057

Re: K&R function definition with typedef parameter names

From Nick Bowler <nbowler@draconx.ca>
Newsgroups comp.lang.c
Subject Re: K&R function definition with typedef parameter names
Date 2020-01-13 22:12 +0000
Organization A noiseless patient Spider
Message-ID <qvipvo$2ba$1@dont-email.me> (permalink)
References <qurl9m$b69$1@gioia.aioe.org> <qurt8i$uqk$1@news.albasani.net> <qv7d3s$1nnr$1@gioia.aioe.org> <qv7gfc$oir$1@news.albasani.net> <3eba021e-5533-4582-b2db-040965839eeb@googlegroups.com>

Show all headers | View raw


On Thu, 09 Jan 2020 08:20:04 -0800, James Kuyper wrote:
> Given that this syntax is still permitted, I think it's likely that
> there's at least a few idiots somewhere still writing new code using
> that syntax. The committee would have at least deprecated the syntax a
> long time ago if they didn't think there were a fair number of people
> who still need it to be supported.

"Idiot" is a bit harsh...  There are actually functions one may
quite reasonably want to write in C that are only possible to
write with old-style definition syntax.

Consider the following:

  void hello(int(*)[*], int);
  void hello(a, n)
     int n;
     int (*a)[n];
  {
     /* ... */
  }

Even though we can write the prototype for hello in standard C, as shown
above, there is no way to use prototype syntax in the function definition.
Only an old-style definition will do.

It's worth pointing out that GCC has an extended prototype syntax which
can be used in definitions of functions like this one.

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


Thread

K&R function definition with typedef parameter names Steve Keller <keller@no.invalid> - 2020-01-04 19:31 -0800
  Re: K&R function definition with typedef parameter names Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-01-05 04:00 +0000
    Re: K&R function definition with typedef parameter names Steve Keller <keller@no.invalid> - 2020-01-09 06:26 -0800
  Re: K&R function definition with typedef parameter names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-04 23:15 -0500
    Re: K&R function definition with typedef parameter names Steve Keller <keller@no.invalid> - 2020-01-09 06:27 -0800
  Re: K&R function definition with typedef parameter names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-05 06:47 +0100
    Re: K&R function definition with typedef parameter names Steve Keller <keller@no.invalid> - 2020-01-09 06:25 -0800
      Re: K&R function definition with typedef parameter names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-09 16:22 +0100
        Re: K&R function definition with typedef parameter names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-09 08:20 -0800
          Re: K&R function definition with typedef parameter names Thiago Adams <thiago.adams@gmail.com> - 2020-01-09 10:49 -0800
            Re: K&R function definition with typedef parameter names David Brown <david.brown@hesbynett.no> - 2020-01-10 10:22 +0100
              Re: K&R function definition with typedef parameter names Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-01-10 13:05 +0000
                Re: K&R function definition with typedef parameter names David Brown <david.brown@hesbynett.no> - 2020-01-10 16:14 +0100
                Re: K&R function definition with typedef parameter names Richard Damon <Richard@Damon-Family.org> - 2020-01-10 11:15 -0500
                Re: K&R function definition with typedef parameter names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-10 20:51 -0500
              Re: K&R function definition with typedef parameter names Thiago Adams <thiago.adams@gmail.com> - 2020-01-10 06:24 -0800
                Re: K&R function definition with typedef parameter names David Brown <david.brown@hesbynett.no> - 2020-01-10 16:26 +0100
          Re: K&R function definition with typedef parameter names Nick Bowler <nbowler@draconx.ca> - 2020-01-13 22:12 +0000
  Re: K&R function definition with typedef parameter names Autist <autist69@gmail.com> - 2020-01-10 16:42 +0100
  Re: K&R function definition with typedef parameter names Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-11 09:56 -0800

csiph-web