DM> But... but... there ARE cases where gotos make sense.
CD> Being from Missouri, I've got to see it to believe it. Even the
CD> various published pundits who say essentially the same as you never
CD> show an example of "the judicious goto".
DM> exit:
DM> /* clean up pointers in reverse order of allocation, only if they
DM> * point to valid memory - don't fclose NULL FILE*'s, don't
DM> * close DosFindFile's that were never initiated or were finished
DM> * properly, etc. */
DM> return ulRC;
DM> }
DM> Single entry. Single exit. Flow always goes 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.
Yeah... I've seen such things. It's not the only way to do it.
Nor are alternative methods (IMO) "less readable".
DM> In C++, however, I can avoid most of this, if not all of it.
Which echo are we on?
CD> I suppose. But I've found a fascinating correlation. There are some
CD> folks who find goto quite useful to exit from deep inside nested
CD> loops. Then there are those who don't get stuck inside of deeply
CD> nested loops in the first place.
DM> I wish all my programs were so simple and never needed modification
DM> like that. Unfortunately, the rest of us live in the real world where
DM> requirements change faster than we can code them in.
What can I say? If you find yourself painted into a corner, you have
to take drastic measures. I still think that avoiding getting stuck
in the corner makes more sense. I don't see where program size nor
complexity matter there.
DM> (We need better
DM> managers, yes. However, that's another real-world factor we have to
DM> live with. I can't afford to change jobs within 4 months of starting
DM> my last one - it just looks bad.)
Not necessarily. Right now, the programming job market
is so tight that the 4 months of experience would qualify you as
an certified expert!
DM> [Sorry, Mr. Moderator, but he's been using that "real-world" line so
DM> long already, and I was just waiting to see it used against him...
I've got no problem there. There aren't two people in the world with
the same real-life experiences. Differing experience is just that.
Differing experience shouldn't imply a lack of experience.
DM> Now
DM> that I've been sated, it won't happen again... I'll probably be
DM> twitted, too ]
Sounds tempting, but I wouldn't want to risk damaging international
relations....
--- Platinum Xpress/Win/Wildcat5! v2.0
---------------
* Origin: St. Louis Users Group (1:100/4)
|