Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2003 Server
>>>Also agree about the exit point. You are using return as a way of breaking out of a process when you hit a certain point. Not a good idea. Much better to set variables at each stage ( if you are checking for bad conditions there may be more than one. Even in testing it would be good to find out about all of them on one pass)
>>
>>I must say that I find this 'one exit point' mantra seems to be confined to ex-VFPers :-}
>>
>>Here's what 'Code Complete' (which is pretty much language agnostic) has to say on the subject:
>>
>>"Use a return when it enchances readablility.
>>In certain routines, once you know the answer, you want to return it to the calling routine immediately. If the routine is defined in such a way that it doesn't require any further cleanup once it detects an error, not returning immediately means that you have to write more code"
>>
>>The accompanying example has three return statements in a method with five lines of code...
>
>
>Side topic, does any other language have a RETURN TO?
>
>Seemed like a VFP novelty. Though I don't remember using it for anything besides an error handler.
If I see RETURN TO MASTER in code, I take that as a sign of really old code and run like hell ;-)
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement