Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #148938
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: K&R function definition with typedef parameter names |
| Date | 2020-01-11 09:56 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <86tv5127xj.fsf@linuxsc.com> (permalink) |
| References | <qurl9m$b69$1@gioia.aioe.org> |
Steve Keller <keller@no.invalid> writes:
> I wonder if the old K&R style function definition allowed to use
> function parameter names that were already typedef'd. Current
> compilers like gcc, clang, and tcc don't allow this:
>
> typedef int t;
> int fun(t)
> int t;
> {
> return 0;
> }
>
> The compilers I tested on this seem to interpret "int fun(t)" as a
> function declaration of fun that takes one argument of type t. I
> don't have any pre C90 compiler available but would like to know how
> this would be handled. If the above was possible in old pre-ANSI C
> this seems to have changed. Was it intentionally and is it stated
> explicitely anywhere?
I think you've already gotten an answer to the second part of
your question.
On the first part -- without having any data to offer, what I
suspect is true is that some pre-standard compilers did one
thing and other pre-standard compilers did something else. In
other words the field was not homogeneous, and the decision was
not to make a "change" but to decide what should be done for
standardized C.
The Rationale document is pretty good about calling out changes
in standard C relative to what was done in pre-standard C. The
Rationale says nothing about the standard C rule being a change
over earlier C compilers. That isn't absolutely compelling
evidence, but it is some evidence that pre-standard compilers
didn't all behave the same way for this scenario.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll 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