TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: CHRIS DOWNS
date: 1997-09-16 17:27:00
subject: Re: WHY THE BRACES?

 DM> Single entry.  Single exit.  Flow always goes 
 DM> down, except in properly
 DM> defined structural loops (while, do while, for).  Clean-up code will
 DM> always get executed.  Adding extra clean-up code will not break
 DM> anything - it will also get executed every time because it is part of
 DM> the single exit. 
   
 CD>  Yeah... I've seen such things.  It's not the only way to do it.
 CD>  Nor are alternative methods (IMO) "less readable".
 DM> Without writing every pointer-resource into classes, I've been hard
 DM> pressed to find other ways of doing it.  Perhaps an example, Chris?
 
 I must be missing something as this sounds like pretty basic stuff
 to me.  All you need do is create an appropriate class and we can
 get the same "will also get executed every time" functionality via
 a destructor rather than using gotos as a funnel to some shared
 code section.  
 You could be making a better case for the example you've described
 over on the C echo.
 DM> Often writing a dozen small classes
 DM> that handle resources is less readable than the goto.
 I would submit that if you needed a dozen small classes to avoid 
 the goto, then the goto (or lack thereof) is not the problem.
 
---
 þ Blue Wave/QWK v2.12 þ
---------------
* Origin: St. Louis Users Group (1:100/4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.