Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Why the C programming language book was never updated past C89? |
| Date | 2015-02-06 10:54 +1300 |
| Message-ID | <cji75fFq43fU2@mid.individual.net> (permalink) |
| References | (3 earlier) <mavqib$ah7$1@dont-email.me> <mavsi2$ibc$1@dont-email.me> <lnoap8kxf2.fsf@nuthaus.mib.org> <mb0gqs$e4i$1@dont-email.me> <lnh9v0kpf8.fsf@nuthaus.mib.org> |
Keith Thompson wrote: > Bartc <bc@freeuk.com> writes: >> Disadvantages of allowing declarations anywhere, and allowing the same >> name to be used in different block scopes: >> >> * When encountering a variable name X, you have to scan backwards every >> line from that point, to the start of the function, to look for the >> nearest definition. [Instead of going straight to the start.] > > For relatively small functions, that shouldn't be too much of a problem. If functions aren't relatively small, size is the problem! >> * If you want to copy and paste fragments of code from one part of a >> function to another, you'd better make sure you take include the >> declarations of any variables! Otherwise there might be nasty surprises. If you want to copy and paste fragments of code, extract them into functions. Copy and paste is the programmer's equivalent of sneezing in a lift - it spreads bugs! >> * If you want to document all the variables in a function, now it's a >> much harder job because the declarations are disseminated through the >> code with possibility of the same name used multiple times. > > I'm not sure documenting all the variables in a function would be > useful. I'd rather document sections of code. In any case, unless your > functions are unreasonably long, mixing declarations and statements > isn't going to be a huge problem; the declarations still aren't that > difficult to find. Add to that variables declared where they are used are way more likely to be self documenting. The context is the documentation. >> * (More of technical objection but I'm uneasy with the idea of having a >> name which is hard to pin down. If I want to talk about variable X in >> function F, I now have to specify exactly which block of F it's defined >> in, especially if there are several Xs; how do I do that?) > > By not defining multiple variables with the same name in the same > function. Also not making functions so complex that is is an issue. >> Actually, given that people are always suggesting to keep functions >> small, you have to wonder why it is necessary to declare a name right >> next to it's first use instead of at the beginning of the function a >> mere dozen lines away, if that. > > It's not *necessary*, but as I wrote upthread it can be handy to define > a variable close to its first use, and to initialize it with a value > that might depend on previous computations. That last point is important, especially if you want the variable to be const. -- Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why the C programming language book was never updated past C89? Kamel Biskri <email@domain.com> - 2014-11-28 23:45 +0100
Re: Why the C programming language book was never updated past C89? Robert Miles <milesrf@Usenet-News.net> - 2015-02-05 04:40 -0600
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 11:08 +0000
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-05 14:18 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 13:52 +0000
Re: Why the C programming language book was never updated past C89? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-02-05 14:32 +0000
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 14:55 +0000
Re: Why the C programming language book was never updated past C89? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-02-05 17:07 +0000
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 14:49 +0000
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 15:01 +0000
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 15:31 +0000
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 15:58 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-05 13:07 -0800
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-05 16:18 -0500
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-05 13:43 -0800
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 21:54 +0000
Re: Why the C programming language book was never updated past C89? jak <please@nospam.tnx> - 2015-03-10 10:43 +0100
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-05 17:01 -0500
Re: Why the C programming language book was never updated past C89? Greg Martin <greg.at.softsprocket@dot.com> - 2015-02-06 15:55 +0000
Re: Why the C programming language book was never updated past C89? Kaz Kylheku <kaz@kylheku.com> - 2015-02-05 21:24 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-05 13:34 -0800
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 21:43 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-05 13:58 -0800
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 22:07 +0000
Re: Why the C programming language book was never updated past C89? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-02-05 18:11 -0500
Re: Why the C programming language book was never updated past C89? Ian Collins <ian-news@hotmail.com> - 2015-02-06 12:15 +1300
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 10:08 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 09:19 +0000
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-06 03:34 -0600
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-06 08:22 -0800
Re: Why the C programming language book was never updated past C89? guinness.tony@gmail.com - 2015-02-06 03:39 -0800
Re: Why the C programming language book was never updated past C89? Kaz Kylheku <kaz@kylheku.com> - 2015-02-06 15:45 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 08:31 -0500
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 13:45 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 09:18 -0500
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-06 07:08 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 15:15 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-06 07:31 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 15:37 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-06 08:15 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 17:13 +0000
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-06 10:48 -0800
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 16:47 +0100
Re: Why the C programming language book was never updated past C89? "Osmium" <r124c4u102@comcast.net> - 2015-02-06 09:52 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 12:08 -0500
Re: Why the C programming language book was never updated past C89? "Osmium" <r124c4u102@comcast.net> - 2015-02-06 11:32 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 12:41 -0500
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-07 14:21 +0100
Re: Why the C programming language book was never updated past C89? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-06 18:03 +0000
Re: Why the C programming language book was never updated past C89? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-02-06 13:28 -0700
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-07 14:22 +0100
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-06 13:56 +0000
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 16:55 +0100
Re: Why the C programming language book was never updated past C89? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-06 18:06 +0000
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 18:16 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 13:34 -0500
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 18:44 +0000
Re: Why the C programming language book was never updated past C89? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-06 19:00 +0000
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-06 17:44 -0600
Re: Why the C programming language book was never updated past C89? Kaz Kylheku <kaz@kylheku.com> - 2015-02-07 01:46 +0000
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-07 00:20 -0600
Re: Why the C programming language book was never updated past C89? Kaz Kylheku <kaz@kylheku.com> - 2015-02-07 06:47 +0000
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-07 01:26 -0600
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-07 01:34 -0600
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-07 11:59 +0000
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-07 11:57 +0000
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-06 10:51 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 19:05 +0000
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-06 11:23 -0800
Re: Why the C programming language book was never updated past C89? wpihughes@gmail.com - 2015-02-06 11:31 -0800
Re: Why the C programming language book was never updated past C89? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-02-06 15:26 -0500
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-09 21:19 +0000
Re: Why the C programming language book was never updated past C89? Jim Barlow <jim.j.barlow@gmail.com> - 2015-02-09 21:16 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-10 05:36 +0000
Re: Why the C programming language book was never updated past C89? Les Cargill <lcargill99@comcast.com> - 2015-02-10 07:53 -0600
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-10 15:08 +0100
Re: Why the C programming language book was never updated past C89? Les Cargill <lcargill99@comcast.com> - 2015-02-10 19:57 -0600
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-11 10:19 +0100
Re: Why the C programming language book was never updated past C89? Les Cargill <lcargill99@comcast.com> - 2015-02-11 07:32 -0600
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-11 15:32 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-11 14:06 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-11 08:07 -0500
Re: Why the C programming language book was never updated past C89? Les Cargill <lcargill99@comcast.com> - 2015-02-11 07:33 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-11 09:08 -0500
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-11 14:29 +0000
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-11 16:28 +0100
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-11 11:52 -0500
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-11 10:37 -0800
Re: Why the C programming language book was never updated past C89? Les Cargill <lcargill99@comcast.com> - 2015-02-11 19:02 -0600
Re: Why the C programming language book was never updated past C89? Ian Collins <ian-news@hotmail.com> - 2015-02-12 14:55 +1300
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-11 15:38 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-11 16:09 +0000
Re: Why the C programming language book was never updated past C89? Phil Carmody <pc+usenet@asdf.org> - 2015-02-14 18:39 +0200
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-10 10:14 +0100
Re: Why the C programming language book was never updated past C89? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-06 17:49 +0000
Re: Why the C programming language book was never updated past C89? Greg Martin <greg.at.softsprocket@dot.com> - 2015-02-06 15:59 +0000
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-06 13:34 +0000
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 16:58 +0100
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-09 21:21 +0000
Re: Why the C programming language book was never updated past C89? Kaz Kylheku <kaz@kylheku.com> - 2015-02-06 20:54 +0000
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-06 21:27 +0000
Re: Why the C programming language book was never updated past C89? Ian Collins <ian-news@hotmail.com> - 2015-02-07 11:31 +1300
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-07 00:22 -0600
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 21:57 +0000
Re: Why the C programming language book was never updated past C89? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-02-05 10:10 -0500
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-05 16:48 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 16:02 +0000
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 10:14 +0100
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 09:26 +0000
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-06 08:36 -0800
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-06 17:20 +0000
Re: Why the C programming language book was never updated past C89? raltbos@xs4all.nl (Richard Bos) - 2015-02-07 12:05 +0000
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-08 12:02 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-05 11:59 -0500
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-05 10:47 -0800
Re: Why the C programming language book was never updated past C89? Bartc <bc@freeuk.com> - 2015-02-05 19:38 +0000
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-05 13:40 -0800
Re: Why the C programming language book was never updated past C89? Ian Collins <ian-news@hotmail.com> - 2015-02-06 10:54 +1300
Re: Why the C programming language book was never updated past C89? Keith Thompson <kst-u@mib.org> - 2015-02-05 15:27 -0800
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-05 13:04 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-05 14:18 -0500
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-05 18:35 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 08:47 -0500
Re: Why the C programming language book was never updated past C89? Robert Wessel <robertwessel2@yahoo.com> - 2015-02-07 00:32 -0600
Re: Why the C programming language book was never updated past C89? Richard Heathfield <rjh@cpax.org.uk> - 2015-02-05 21:53 +0000
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-05 12:17 -0500
Re: Why the C programming language book was never updated past C89? David Brown <david.brown@hesbynett.no> - 2015-02-06 10:26 +0100
Re: Why the C programming language book was never updated past C89? "Osmium" <r124c4u102@comcast.net> - 2015-02-05 08:26 -0600
Re: Why the C programming language book was never updated past C89? James Kuyper <jameskuyper@verizon.net> - 2015-02-06 09:12 -0500
csiph-web