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


Groups > comp.lang.c > #148908

Re: K&R function definition with typedef parameter names

Newsgroups comp.lang.c
Date 2020-01-10 06:24 -0800
References (2 earlier) <qv7d3s$1nnr$1@gioia.aioe.org> <qv7gfc$oir$1@news.albasani.net> <3eba021e-5533-4582-b2db-040965839eeb@googlegroups.com> <a9bd7ff2-4f04-4b8c-9d7f-c194b32d76a5@googlegroups.com> <qv9fo5$j60$1@dont-email.me>
Message-ID <5df7c02a-eefc-4307-adb8-442c957d2e97@googlegroups.com> (permalink)
Subject Re: K&R function definition with typedef parameter names
From Thiago Adams <thiago.adams@gmail.com>

Show all headers | View raw


On Friday, January 10, 2020 at 6:22:22 AM UTC-3, David Brown wrote:
[...]
> And I am completely at a loss to see how K&R style function definitions
> ever offer any kind of advantage over modern C function definitions with
> full prototypes.  Maybe I have missed something that you are thinking
> about, and you can elaborate.

I was not aware of this performance problem.

This is the situation I have in mind:

Let's say I decide to implement the C++ operator delete
in my transpirer cprime (that generates C code)


struct X * p = ...;

delete p;

In this case I have to transform 'delete p' in a function call
or make it inline.

If I use some kind of name mangling, let's say 'X_delete',
I could just output without any declaration:

X_delete(p);

One alternative, like you suggest, is to output in the 
line above the declaration

void X_delete(struct X* p);
X_delete(p);

the 'problem' Is when the same function is used many
times. In this case, for better readability, I could add
just one. (count the number of declarations generated)

void X_delete(struct X* p);
X_delete(p1);
X_delete(p2);


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