3 ms·
Goto is often used in assembler and low level C code that essentially mocks assembler, but spaghetti for procedural and OOP styles. I actually found a goto in
by Clubber 9y ago
Goto is often used in assembler and low level C code that essentially mocks assembler, but spaghetti for procedural and OOP styles.
I actually found a goto in a C# project I took over this year and one of the first things I did was change it to a while loop with a break.
- IWeldMelons 9y agogoto is used in pure c code as a substitute to exceptions, to prevent unnecessary repetition of the resource deallocation code. Even in C++ code, it is often way faster than exceptions. Goto is not scary.
- stochastic_monk 9y agoThe point is that exceptions should be used for exceptional cases only. Most situations (e.g., early returns) for which resource management would be handled by a goto are already addressed by RAII.