On Monday, Shayan asked on irc:

> should our webvtt parser include 'goto' statements? ive always been
> taught not to use them. what are your thoughts

I'm fine with the goto statements in the webvtt parser.

You're correct that they're often a bad idea because they break nested
flow-control. However, jumping to common code in parser state machines
is one of the few places they make sense. They're essentially
implementing an exception handler. Without 'goto' cleanup code has to be
duplicated for every fatal error check, and using macros instead is even
harder to keep track of when reading the code. As long as the jump
labels are nearby and aren't part of the normal execution path they're a
reasonable choice.

 -r
_______________________________________________
dev-media mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-media

Reply via email to