[fpc-pascal] Re: Can variables be declared within a block?

Vinzent Höfler JeLlyFish.software at gmx.net
Tue Oct 19 20:58:44 CEST 2010


On Tue, 19 Oct 2010 02:07:25 +0200, Dimitri Smits <smitco at telenet.be>
wrote:

> on the other hand, what stops the OP from using 'with'? (multiple  
> levels/variables?)

"with" contaminates the name space. Locally scoped variables don't.

> and you won't die from using another stack variable scoped at the  
> beginning of the method.

True. If the subroutine is long enough that an additional declaration
block seems necessary, it's probably too long already.

> just to say that I'm not too fond of that c-ism in a pascal language  
> (although I've used it plenty in c++, java, C#, php, ... over the years).

Just because C has it doesn't mean it is a C-ism. Local declaration blocks
are definitely not an invention of C. IIRC, C89/90 didn't even had it yet.


Vinzent.



More information about the fpc-pascal mailing list