On Thu, 29 Jan 2004 23:45:25 +0200, in comp.lang.c , Papadopoulos
Giannis <> wrote:
>a) pre vs post increment/decrement
>
>I have read somewhere that:
>
>“Prefer pre-increment and -decrement to postfix operators.
Yes, this is an old chestnut. I can find nothing to support it
nowadays, tho ICBW.
>i++;
>and
>++i;
>would give the same instructions?
AFAIK yes. Try it and see.
>b) I find that realloc() calls sometimes take more time to complete than
>malloc() calls. Is this the general case?
The standard doesn't say.
>c) Why do some people declare all the variables at the start of each
>function?
Until C99, you pretty much had to do it like that. Plus many people
consider it a good idea to keep your declarations in one place for
easier reference. Spraying declarations around through the body of
your code makes it a lot harder to follow.
> And I mean ALL variables, including those that are nested in
>deep fors and ifs...
I agree, this is often a bad idea.
>I don’t see any obvious performance gains
Again, C doesn't say.
> unless they do it to remember what they are using...
Which may be a performance gain in itself of course
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---