>>/ Please just use goto to handle errors.
/>/
/>/ /*When we talk coding style with students, the first comment I have is :
/>/ DO NEVER USE GOTO STATEMENT BUT USE IF ELSE IF ...
/
I'm afraid that's not only doing your students a disservice, but also
their future employers.
Sorry, but I prefer to use structured approach where neither /goto/ nor
multiple /returns/ are needed.
But if readability is only your concern, GOTO is not so bad.
>/ Sometimes goto is still used in complicated function to simplify
/>/ the jump ... But the better should be to split your complicated
/>/ function in sub functions ...
/
Creating sub functions is a good workaround in languages where goto
is missing, but in C that is not the case. Again; please just use
goto to handle errors.
Have a look at the Linux kernel, they do this well over there.
Yes, I am sure goto is used somewhere in the big Linux kernel source
code . And that's not a problem for me.
But my experience say me that /using goto/ is a symptom of a bigger set
of problems ...
That's only code style, nothing else ;-)
//Peter
I do not like to code spaghetti using goto statement , but I like to eat
spaghetti!
Regards,
Laurent
http://www.amontec.com
http://www.amontec.com/jtagkey.shtml
Amontec JTAGkey-2 High-speed USB JTAG dongle
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development