SCOUG-Programming Mailing List Archives
Return to [ 13 | 
February | 
2004 ]
<< Previous Message << 
 
 
 
Content Type:   text/plain 
"...Of these three options, I chose BEGIN.  When I leave the   
BEGIN block everything is wrapped up automatically and I   
have a "fresh start" for the following section of code without   
having to check backwards to see what was allocated and   
must be deallocated. ..."  
 
Everything is not wrapped up automatically.  Only variables   
with the automatic, controlled, or based storage attributes get   
deallocated on exiting the begin-block.  That says variables   
with the static storage attribute do not.  If you have the same   
static variable name declared twice within a procedure, one   
declaration must fall will a begin block so that the compiler   
knows which is in effect when evaluating an expression.  
 
Again that's one of the two original uses of the begin-block.    
If you enjoy having a variable dynamically allocated on entry   
to a begin block and deallocated on exit, that's your pleasure.    
It still requires two statements, a begin and an end.  While it is   
fewer keystrokes than an allocate and free statement, it has   
the same effect.  It still requires the same attention to detail   
as to when allocation and deallocation occurs.  
 
You do it with begin (allocate) and end (free), while most   
prefer to make it explicit instead of implicit.  Your choice.  
 
I thank Bob for reinforcing my earlier response.  
 
 
=====================================================  
 
To unsubscribe from this list, send an email message  
to "steward@scoug.com". In the body of the message,  
put the command "unsubscribe scoug-programming".  
 
For problems, contact the list owner at  
"rollin@scoug.com".  
 
=====================================================  
 
  
<< Previous Message << 
Return to [ 13 | 
February | 
2004 ] 
  
  
The Southern California OS/2 User Group
 P.O. Box 26904
 Santa Ana, CA  92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group.  ALL RIGHTS 
RESERVED. 
 
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International 
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
 
 |