-=> Quoting Aare Tali to Daniel Jones
> I'm not sure I follow you here. When you find a
> variable, the
> declaration should be right there. No steps are
> necessary. No paging
> back to the top of the page or function.
AT> void foo()
AT> {
AT> int i;
AT> for (i = 0; i < 5; i++)
AT> do_something(i);
AT> for (int j = 0; j < 5; j++)
AT> do_something_else(j);
AT> if (i < 5)
AT> not_everything_was_done_with_i();
AT> if (j < 5)
AT> not_everything_was_done_with_j();
AT> }
1. Move the if (i<5) up to before the for(j...) loop.
2. This won't compile - j is an unidentified parameter in the
line that is 'if (j < 5)'.
Your "simple example" is nice, but wrong. You can't do this. There probably
is a better example - but I'll ask you to come up with it. :-)
AT> In C you have to _go to_ the beginning and look around there, in
(unless it's global, of course. And which beginning? The beginning of this
scope, the next inner one, the next inner one...)
AT> C++ you have to _scan_ looking around all the way. Unless you write
AT> 5-line-functions where you can't put declaration smore than 5 lines
AT> away from the line where you used the variable last time.
Which isn't that bad of an idea anyway.
AT> OK with me, but i usually don't look at assignments, for, do or
AT> while statements when i try to find variabler declarations ;)
Which is ok - you don't have to.
... Programmers don't get sniffles, they get a CODE.
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)
|