Are there any legitimate use-cases for “goto” in a language that supports loops and functions?

I’ve long been under the impression that goto should never be used if possible.

However, while perusing libavcodec (which is written in C) the other day, I was surprised to notice multiple uses of it.

Is it ever advantageous to use goto in a language that supports loops and functions? If so, why? Please provide a concrete example that clearly justifies the use of a goto.

26 Answers
26

Leave a Comment