Quoting "Theodore H. Smith" <[EMAIL PROTECTED]>:

> Block scoping was more a C++ trick to be honest. It allowed for
> better control of object destructors.

yes that's another reason for using it (with stack objects).

However, adding blocks just to get local scoping is an old-time C  
programmer's trick and there was a point at which compiler  
optimisation passes were much better at putting those into registers  
than more widely scoped variables. This may have been before you were  
born (no offense, more a wry acknowledgement of passing years).

Compilers got better so the habit became less necessary.

The other C++ nicety is creating const locals as temporaries, which is  
a nice way to get more readable code and make it even easier for the  
optimiser because you've guaranteed they aren't supposed to be updated.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to