Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: disadvantages of using old parameter syntax? |
| Date | 2015-09-09 13:18 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <msp4f5$j7p$1@dont-email.me> (permalink) |
| References | <msc3ru$d6a$1@speranza.aioe.org> <msc8l0$rjd$1@dont-email.me> <7e4a07d7-c3b1-4e85-b4c6-baff554aa73c@googlegroups.com> <87y4ggl88u.fsf@bsb.me.uk> <826a3edc-d200-43c5-a94f-f6fd00d6b000@googlegroups.com> |
On 09/09/15 03:09, Rick C. Hodgin wrote:
> On Tuesday, September 8, 2015 at 8:57:47 PM UTC-4, Ben Bacarisse wrote:
>> "Rick C. Hodgin" <rick.c.hodgin@gmail.com> writes:
<snip>
>> In the more common case of using a function with only a
>> declaration ins scope, there is nothing to go on:
>>
>> int printf();
>> double sin();
>
> Yes, I would think that should've either been done away with, or
> equated to this formal declaration:
>
> int printf(void);
> double sin(void);
That's what C++ did - but C++ is a different language, and was therefore
allowed to change the rules. C tries its best to keep backwards
compatibility with old code and old standards - code that used to work
in a particular way with an old compiler should continue to work in the
same way with a newer compiler. This means that newer compilers and
standards have to accept code that could now be written in a better way,
but that's the price you pay for backwards compatibility.
>
>>> In addition,
>>> what's to prevent the old syntax from being prototyped in a .h file?
>>
>> I don't know what that means. You can't give prototypes for old-syntax
>> function declarations, if that's what you mean, because you'll change
>> the meaning of the code in some cases.
>
> Well ... I don't see how that would be possible. I would think the
> C compiler would find the second instance, which did not have its
> parameters specified by types, and use the prototype, or, if they
> were specified by types and they varied, then it would generate an
> error that something was wrong.
It won't find the two instances if they are in two different compilation
units.
>
>>> Do modern C compilers ignore forward declarations when they encounter
>>> the old style syntax?
>>
>> They have to handle it as old compilers did. It's important for old
>> code that the semantics remain the same.
>>
>> void f(float f) { ... }
>> void f(f) float f; { ... }
>>
>> do not mean quite the same thing. The declaration is not ignored but
>> must be take to mean what K&R intended.
>
> That's what my comment meant that compilers could be changed to have
> them mean the same thing.
When you first decide to change things (which a different language, such
as C++, is able to do - but which the C committee only does in
exceptional circumstances), then it is far better to make the old, bad
way an error than to silently and subtly change it into something
/almost/ the same. If the C committee ever feels that there is so
little legacy K&R code in use that there is no need for the next C
standard to support it, then "void f(f) float f; { ... }" will be a
syntax error.
>
>> (I'm not giving details because
>> there is no earthly reason to use this syntax now. Prototypes were
>> probably the single best change to C that has happened since I've been
>> using it. No one should have to go back.)
>
> I'm just curious here, by the way. I have no plans to use it, or to
> resurrect the idea. It just doesn't make sense to me. It makes more
> sense if forward prototype definitions are not allowed at all. It makes
> no sense to me if they are, and the void f(f) float f; { ... } syntax
> above is allowed. I think it should be allowed, and it should convey
> the same meaning as void f(float f) { ... }, with or without a forward
> prototype.
Compilers are free to disallow such function definitions (though not by
default, as the standards say they must be allowed). So with gcc
warnings such as "-Wmissing-parameter-type -Wold-style-declaration" will
give you this.
>
> But, it's not important. You don't need to respond.
>
> Best regards,
> Rick C. Hodgin
>
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-04 20:46 +0800
Re: disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-04 20:49 +0800
Re: disadvantages of using old parameter syntax? raltbos@xs4all.nl (Richard Bos) - 2015-09-04 16:19 +0000
Re: disadvantages of using old parameter syntax? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-04 10:10 -0400
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 17:07 -0700
Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 01:57 +0100
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 18:09 -0700
Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 02:47 +0100
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 19:34 -0700
Re: disadvantages of using old parameter syntax? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-09 12:07 +0100
Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-09 13:18 +0200
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-04 07:23 -0700
Re: disadvantages of using old parameter syntax? mark.bluemel@gmail.com - 2015-09-04 07:45 -0700
Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-05 14:59 +0200
Re: disadvantages of using old parameter syntax? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-07 13:26 -0700
Re: disadvantages of using old parameter syntax? David Brown <david.brown@hesbynett.no> - 2015-09-08 08:51 +0200
Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 13:35 +0200
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 13:59 +0200
Re: (Not) discussing C-like toy languages gazelle@shell.xmission.com (Kenny McCormack) - 2015-09-08 12:35 +0000
Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 17:55 +0200
Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 13:11 -0400
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 10:19 -0700
Re: (Not) discussing C-like toy languages Noob <root@127.0.0.1> - 2015-09-08 21:31 +0200
Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-08 20:33 +0100
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 22:56 +0200
Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 19:31 +0000
Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-20 16:09 -0400
Re: (Not) discussing C-like toy languages Morris Dovey <mrdovey@iedu.com> - 2015-09-21 18:51 -0500
Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-20 21:27 +0100
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-08 22:52 +0200
Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-08 21:59 +0100
Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 19:31 +0000
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-20 13:54 -0700
Re: (Not) discussing C-like toy languages Gareth Owen <gwowen@gmail.com> - 2015-09-08 21:28 +0100
Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 10:56 -0400
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 08:33 -0700
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 09:12 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 09:18 -0700
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 10:15 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 08:38 -0700
Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-08 16:50 -0700
Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-08 21:24 -0400
Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-11 08:45 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-11 08:54 -0700
Re: (Not) discussing C-like toy languages luser droog <luser.droog@gmail.com> - 2015-09-11 21:22 -0700
Re: (Not) discussing C-like toy languages Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-13 06:42 +0000
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-12 23:54 -0700
Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-13 10:41 -0500
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 09:52 -0700
Re: (Not) discussing C-like toy languages Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-13 20:27 +0000
Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:32 -0500
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 09:55 -0700
Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:07 +1200
Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 14:23 -0700
Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:31 +1200
Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 14:33 -0700
Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 09:40 +1200
Re: (Not) discussing C-like toy languages "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-09-13 15:05 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 00:10 +0200
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-13 17:16 -0700
Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:36 -0500
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 14:29 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-13 23:47 +0200
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-13 17:55 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 10:20 +0200
Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-14 11:01 +0100
Re: (Not) discussing C-like toy languages Ian Collins <ian-news@hotmail.com> - 2015-09-14 22:07 +1200
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 12:41 +0200
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 03:47 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 04:05 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 04:20 -0700
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 05:51 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 06:06 -0700
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 06:26 -0700
Re: (Not) discussing C-like toy languages gazelle@shell.xmission.com (Kenny McCormack) - 2015-09-14 13:43 +0000
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 07:26 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 06:47 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 03:31 -0700
Re: (Not) discussing C-like toy languages James Kuyper <jameskuyper@verizon.net> - 2015-09-14 06:40 -0400
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 14:27 +0200
Re: (Not) discussing C-like toy languages Richard Heathfield <rjh@cpax.org.uk> - 2015-09-14 13:39 +0100
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 05:55 -0700
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 05:50 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 15:58 +0200
Re: (Not) discussing C-like toy languages "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 07:37 -0700
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-14 07:43 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 17:21 +0200
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-14 08:53 -0700
Re: (Not) discussing C-like toy languages David Brown <david.brown@hesbynett.no> - 2015-09-14 18:23 +0200
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-14 10:57 -0700
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-17 17:43 -0700
Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 20:50 +0000
Re: (Not) discussing C-like toy languages raltbos@xs4all.nl (Richard Bos) - 2015-09-20 20:48 +0000
Re: (Not) discussing C-like toy languages Keith Thompson <kst-u@mib.org> - 2015-09-14 07:58 -0700
Re: (Not) discussing C-like toy languages Les Cargill <lcargill99@comcast.com> - 2015-09-14 21:35 -0500
Re: (Not) discussing C-like toy languages Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 23:56 -0700
Re: (Not) discussing C-like toy languages fir <profesor.fir@gmail.com> - 2015-09-08 08:07 -0700
Re: disadvantages of using old parameter syntax? luser droog <luser.droog@gmail.com> - 2015-09-08 17:40 -0700
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-08 17:59 -0700
Re: disadvantages of using old parameter syntax? James Kuyper <jameskuyper@verizon.net> - 2015-09-04 10:48 -0400
Re: disadvantages of using old parameter syntax? Paul N <gw7rib@aol.com> - 2015-09-07 12:48 -0700
Re: disadvantages of using old parameter syntax? Anonymous Shadow <rocket.penguin@riseup.net> - 2015-09-12 15:35 +0800
Re: disadvantages of using old parameter syntax? Keith Thompson <kst-u@mib.org> - 2015-09-12 14:25 -0700
Re: disadvantages of using old parameter syntax? supercat@casperkitty.com - 2015-09-12 14:53 -0700
Re: disadvantages of using old parameter syntax? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-12 18:21 -0400
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-14 11:41 -0700
Re: disadvantages of using old parameter syntax? Rosario19 <Ros@invalid.invalid> - 2015-09-16 09:02 +0200
Re: disadvantages of using old parameter syntax? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-09-16 01:12 -0700
csiph-web