General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
yapdog
Low Level
comments
Comments by "yapdog" (@yapdog) on "why is it illegal to use "goto"?" video.
Eff that! I've been using gotos in C for over 3 decades, and I have no intention of removing them. I use goto in virtually every function in my OS. I use them for error value reporting, jumping to the bottom of the function, thus having only 1 goto error exit point (e.g. "error_exit") and 1 success exit point (e.g. "success_exit") for every single function while having a much more descriptive error log. So, I would even modify your code example by only having the error gotos log the error then goto "error_exit" where the error return value is set. And since the cleanup may need to be performed regardless of success or failure along the way, "error_exit" then goes to "success_exit" where said cleanup is handled. Without having to check error logic, this is clean and consistent, becoming second nature when you write functions.
2