Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Open letter to Ian Collins |
| Date | 2012-05-27 12:25 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <jpt30f$sdq$1@dont-email.me> (permalink) |
| References | <jprl29$ifd$1@speranza.aioe.org> <a2dhipF7faU1@mid.individual.net> <jpssi6$tf0$2@dont-email.me> <a2ee73F7faU5@mid.individual.net> |
"Ian Collins" <ian-news@hotmail.com> wrote in message news:a2ee73F7faU5@mid.individual.net... > On 05/27/12 09:36 PM, BartC wrote: >> "Ian Collins"<ian-news@hotmail.com> wrote in message >>> It be a lot easier to see what is what if these were declared on first >>> use. >> >> As in, instead of reading a play which starts with a cast of characters, >> they should be introduced whenever they first appear? >> >> Suppose you're delving into a random scene, (or have an extract for use >> elsewhere), and want to be reminded who a character is, you have to start >> ploughing through from page one first until you encounter their first >> mention? > > A function is more like a limerick than a play. In that case I can't see it being a big imposition if the names were declared at the top of the function (ie. at the top of the screen if a function is small). Then it gets the clutter out of the code. And all uses of the name are identical (instead of one of them needing a declaration). Although, it will make the function a bit longer.. >> Getting back to C, wouldn't macros and enumerations .... also >> all benefit from being declared where they are first used? > I would make them longer, unlike declaring variables when they are needed > makes them shorter. That's another thing; uses of i, j and k for loop indices is fairly standard. They probably will be ints, and the formality of having to declare them can be kept out of the way instead of making for-loops even longer. (Alternatively for-loop variables could be implicitly declared.) > Besides, how do you introduce a const other that where it is initialised? What do you mean by a const? If it is a name that is to be used in several places, then it can also benefit from splitting declaration (and initialisation) from it's use. It gets more complicated when declarations in blocks are used (which apparently have their own name spaces). But I've never used those, and if functions are small as everyone says they should be, I can't see the need. (Of course my point of view is from reading code rather than writing it. But the former should have priority.) -- Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 00:22 +0200
Re: Open letter to Ian Collins Ike Naar <ike@sverige.freeshell.org> - 2012-05-26 22:36 +0000
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 01:13 +0200
Re: Open letter to Ian Collins Barry Schwarz <schwarzb@dqel.com> - 2012-05-26 16:53 -0700
Re: Open letter to Ian Collins Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-26 16:41 -0700
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-26 22:43 -0400
Re: Open letter to Ian Collins Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-26 15:41 -0700
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 01:14 +0200
Re: Open letter to Ian Collins MelissA <melis@a.com> - 2012-05-27 00:52 +0200
Re: Open letter to Ian Collins Stephen Sprunk <stephen@sprunk.org> - 2012-05-26 20:40 -0500
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 09:32 +0200
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-27 07:18 -0400
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-27 14:24 +1200
Re: Open letter to Ian Collins "BartC" <bc@freeuk.com> - 2012-05-27 10:36 +0100
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-27 22:33 +1200
Re: Open letter to Ian Collins "BartC" <bc@freeuk.com> - 2012-05-27 12:25 +0100
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-28 07:17 +1200
Re: Open letter to Ian Collins Ike Naar <ike@sverige.freeshell.org> - 2012-05-27 13:03 +0000
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-27 15:16 +1200
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 09:30 +0200
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-27 20:56 +1200
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 11:12 +0200
Re: Open letter to Ian Collins Ian Collins <ian-news@hotmail.com> - 2012-05-27 21:22 +1200
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-27 07:15 -0400
Re: Open letter to Ian Collins Keith Thompson <kst-u@mib.org> - 2012-05-27 07:49 -0700
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-27 13:55 -0400
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 22:24 +0200
Re: Open letter to Ian Collins "BartC" <bc@freeuk.com> - 2012-05-27 22:09 +0100
Re: Open letter to Ian Collins Keith Thompson <kst-u@mib.org> - 2012-05-27 14:33 -0700
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-27 17:49 -0400
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-27 17:31 -0400
Re: Open letter to Ian Collins Philip Lantz <prl@canterey.us> - 2012-05-28 01:38 -0700
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-05-28 08:18 -0400
Re: Open letter to Ian Collins "BartC" <bc@freeuk.com> - 2012-05-27 15:46 +0100
Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-06-13 21:25 -0400
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-06-13 21:52 -0400
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-06-14 04:00 +0200
Re: Open letter to Ian Collins pete <pfiland@mindspring.com> - 2012-06-14 00:04 -0400
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-27 09:42 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-28 12:39 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-28 21:44 +0200
Re: Open letter to Ian Collins jacob navia <jacob@spamsink.net> - 2012-05-29 09:46 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-29 10:06 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-29 10:37 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-29 10:58 +0200
Re: Open letter to Ian Collins "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> - 2012-05-29 11:34 +0200
Re: Open letter to Ian Collins Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-29 03:02 -0700
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-29 09:59 +0200
Re: Open letter to Ian Collins "io_x" <a@b.c.invalid> - 2012-05-29 20:09 +0200
Re: Open letter to Ian Collins "Sarah Wren" <swreb@ameritech.net> - 2012-05-29 01:40 -0600
csiph-web