Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: selection-sort in C |
| Date | 2011-08-16 16:33 +0000 |
| Organization | Eindhoven University of Technology |
| Message-ID | <slrnj4l6ui.ufo.willem@toad.stack.nl> (permalink) |
| References | (1 earlier) <871uwlk39e.fsf@bazspaz.fatphil.org> <4e4a563d$0$313$14726298@news.sunsite.dk> <0.8ac9a68b92bf7919228a.20110816132259BST.87pqk5eeak.fsf@bsb.me.uk> <20110816180334.7abc4a00@arcadia> <j2e5m6$6hh$1@news.albasani.net> |
karnath wrote:
) On 2011-08-16, Thomas Boell <tboell@domain.invalid> wrote:
)> If the compiler would do the allocation (i. e. reserving space on the
)> stack) exactly where it's requested, it would be more expensive to
)> declare the variable inside the loop. But I doubt that any optimizing
)> compiler would do that in this case; the allocation would be moved
)> outside the loop, or possibly the variable is allocated in a free
)> register, so allocating the variable inside the loop isn't any more
)> expensive than outside.
)>
)
) Asking for clearance.
)
) If we are using compiler without optimization it would be right to
) put initialization before scope in topic case, won't it?
No.
If you are using compiler without optimization you obviously don't care
about performance, so it would not be right. You should write code in
the most clear way, and keeping declarations close to usage is clearer
according to most opinions.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
selection-sort in C arnuld <sunrise@invalid.address> - 2011-08-16 11:08 +0000
Re: selection-sort in C Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-08-16 14:24 +0300
Re: selection-sort in C arnuld <sunrise@invalid.address> - 2011-08-16 11:36 +0000
Re: selection-sort in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-08-16 13:22 +0100
Re: selection-sort in C arnuld <sunrise@invalid.address> - 2011-08-16 13:44 +0000
Re: selection-sort in C Anand Hariharan <mailto.anand.hariharan@gmail.com> - 2011-08-16 07:36 -0700
Re: selection-sort in C Thomas Boell <tboell@domain.invalid> - 2011-08-16 18:03 +0200
Re: selection-sort in C karnath <karnathtorjian@gmail.com> - 2011-08-16 16:25 +0000
Re: selection-sort in C Willem <willem@toad.stack.nl> - 2011-08-16 16:33 +0000
Re: selection-sort in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-08-16 20:03 +0100
Re: selection-sort in C Keith Thompson <kst-u@mib.org> - 2011-08-16 09:27 -0700
Re: selection-sort in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-08-17 20:17 +0000
Re: selection-sort in C pete <pfiland@mindspring.com> - 2011-08-18 00:41 -0400
Re: selection-sort in C Ben Pfaff <blp@cs.stanford.edu> - 2011-08-17 21:52 -0700
Re: selection-sort in C pete <pfiland@mindspring.com> - 2011-08-18 01:07 -0400
Re: selection-sort in C blp@cs.stanford.edu (Ben Pfaff) - 2011-08-17 22:36 -0700
Re: selection-sort in C pete <pfiland@mindspring.com> - 2011-08-18 07:00 -0400
Re: selection-sort in C BGB <cr88192@hotmail.com> - 2011-08-16 14:41 -0700
Re: selection-sort in C Ian Collins <ian-news@hotmail.com> - 2011-08-17 10:10 +1200
Re: selection-sort in C BGB <cr88192@hotmail.com> - 2011-08-16 17:25 -0700
Re: selection-sort in C pacman@kosh.dhis.org (Alan Curry) - 2011-08-17 01:53 +0000
Re: selection-sort in C Gene <gene.ressler@gmail.com> - 2011-08-16 05:27 -0700
Re: selection-sort in C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-08-16 07:24 -0700
Re: selection-sort in C pete <pfiland@mindspring.com> - 2011-08-16 19:22 -0400
Re: selection-sort in C arnuld <sunrise@invalid.address> - 2011-08-17 07:52 +0000
Re: selection-sort in C Angel <angel+news@spamcop.net> - 2011-08-17 10:15 +0000
Re: selection-sort in C Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-08-17 13:22 +0300
Re: selection-sort in C pete <pfiland@mindspring.com> - 2011-08-18 00:33 -0400
csiph-web