[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [palito-dev] /cheat
From: |
barrett |
Subject: |
Re: [palito-dev] /cheat |
Date: |
Sun, 17 Aug 2003 12:03:33 -0300 |
User-agent: |
Mutt/1.4.1i |
On Sat, Aug 16, 2003 at 04:56:20AM +0100, Tom Barnes-Lawrence wrote:
> Ah, the wonders of declaring variables local to blocks. This time,
> you've got one after the first statement of the block- I didn't know
> any version of C supported *that*...
Neither do I.
It's the gcc from my relatively new Slackware 9 that's accepting it,
and it makes me forget misplaced declarations now and then.
> Incidentally, why do you keep doing that? Back when I'd been trying to
> find the bug with the X version of flush, I was trying to watch what
> a for loop did. But I'd put my breakpoint after the loop, and so
> when it reached it, those variables that had been written were no
> longer available (because they were only local to the for loop).
> Boo! Hiss! Boo! And so on. So is there some advantage to doing this,
> or is it just a matter of programming style?
It's just a matter of programming style. It's better, for clarity purposes,
to keep the declaration close to where the variable is used.
Barrett.