Angus Leeming <[EMAIL PROTECTED]> writes:
| On Thu, 19 Oct 2000, Lars Gullik Bjønnes wrote:
| > Juergen Vigna <[EMAIL PROTECTED]> writes:
| > | On 19-Oct-2000 Lars Gullik Bjønnes wrote:
| > | > [EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:
| > | >| And I really don't like how variables are declared at the top and used
| > | >| inside separate blocks (ref. int cell)
| > | >
| > | > This would suit me a lot better:
| > |
| > | Well and I don't get what we gain with this? We NEED that variable all
| > | over (so no case we wouldn't need it), so why allocating it X times if
| > | just 1 time is enough!
| >
| > It is cleaner, you get beter localization of variables (which is a
| > good thing!), you get a clear notion about what this variable is used
| > for, it is easier to split the said function into more functions.
| >
| > | I undersand it if it would be just a local reference variable but we use
| > | it in 3 forloops!
| >
| > Yes, same variable for different things in three different for loops.
| > (and that is not nice)
|
| I think that Jürgen is asking the question, "is it more expensive to assign
| PODs (your notation I think) or to construct them?" Well, if he
| isn't, I am!
Slightly more expensive (but somethinges it actually is better¹), but
often optimized by the compiler anyway.
And I would put this in the "premature optimization" cathegory anyway.
IMNSHO we gain more than we loose.
¹ Welcome to the mysterious world of optimizing compilers.
Lgb