|
|
|
|
|
by paulrpotts
1093 days ago
|
|
I do think there are a few legitimate uses in straight C code, usually in a multiple error exit condition with cleanup situation, or to break out of multiple levels of nested loop without adding flags. I myself was indoctrinated hard into structured programming early on and so I cannot bring myself to use it but reading other people's code, I don't mind it if it is used in one of these cases and the flow is clear. Actually I do mind - I'd like to see C with some additional control structures. I wrote a bit about this in a blog post a few years ago: https://thepottshouse.org/paul/the_books_that_wrote_me_blog/... Also, I feel like many developers never learned do/while and continue, or the variations that are possible in a for loop other than just incrementing and testing a single variable, and their code can often be simplified using these things while removing goto. It doesn't seem like it is at all idiomatic in C++ so I'd be curious to see what you're doing. As another poster mentioned it would certainly interact poorly with RAII, but not all code needs or uses RAII in all functions. |
|