goto skips declaration of variable

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 21 10:39:16 PDT 2014


On 08/21/2014 04:12 AM, nrgyzer wrote:

 > I'm using the goto-command to exit my function
 > if an error (not necessarily an exception) occured.

Sorry to repeat myself but if an exception occurs in code before the 
goto, the exit code will not be executed. Of course, it may be that the 
function is defined 'nothrow' so my concern does not apply.

 > Sure, I can
 > simply do a return, but I personally prefer a fixed endpoint of
 > my functions.

Again, that is not possible in a language that has exceptions.

Ali



More information about the Digitalmars-d-learn mailing list