Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Argument starter - The roots of all evil
Message
De
01/09/2004 02:37:14
 
 
À
31/08/2004 21:23:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00938079
Message ID:
00938312
Vues:
22
>Hi Rich,
>
>SNIP
>>
>>On the other hand, I fully agree with you about multiple RETURNS. My worst nightmares were debugging code I wrote before I learned my lesson about that.
>
>I ask in earnestness... what is it that is bad about multiple RETURNs?
>Personally, I find them helpful in debugging and not at all hurtful. They save the amount of code that I have to go through to find the malfunction, which to me is always a plus. I would also think that you end up with extra coding to accomplish the feat, and such code solely to enable you to get to the single exit only adding complexity.
>
>Jim
I had a reasonably long program with several loops, scans, etc. Things started going bad. I don't remember the details - let's say it was a data type mismatch error. I found that the multiple RETURNS made it extremely hard to debug. I had to find all the exit points and set multiple break points. I couldn't set a watch on TYPE('lnReturn'). I wound up stepping through a lot of code before I eventually found the problem. I've had other problems with bypassing clean up code as I exit the module.

You can make the same arguement I made about LOOP, EXIT and GOTO. The problem isn't really with code, but how I used it. On the other hand, my experience is that it is much easier to produce errors with mulitple RETURNS than with LOOP/EXIT. About the only time I do it now is in simple utilities which don't mess with environment and can be resolved into simple DO CASE statements.

At any rate, that's my take on it.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform