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

David W Noon david.w.noon at ntlworld.com
Tue Oct 19 00:16:57 CEST 2010


On Mon, 18 Oct 2010 19:46:04 -0200, Andreas Berger wrote about Re:
[fpc-pascal] Can variables be declared within a block?:

> 
> > for (int i = 0;...)
> > Can't see anything wrong. I use declaration of variables inside
> > blocks quite often in Java and C++ but have never missed it in
> > pascal. Please enlighten me. What is so bad about creating
> > temporary variables inside blocks instead of the beginning of a
> > function in a language that supports it?
> >
> > R.
> But it should make you wonder why this is no longer allowed in the 
> latest C++ standards.

What do you mean?

The current C++ standard (ISO 1998+TR1) permits short scope
declarations.  Indeed, C++ permits declarations to appear anywhere, not
just after a { to open a function or compound statement.  It has done
since the A.R.M. days, and in some implementations before that.
-- 
Regards,

Dave  [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
david.w.noon at ntlworld.com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20101018/cc289494/attachment.sig>


More information about the fpc-pascal mailing list