I don't usually code C++, but a strange comp sci friend of mine got sick of looking at my wonderful FORTRAN programs and challenged me to rewrite one of them in C++, since he likes my C++ codes better. (We're betting money here.) Exact terms being that it needs to be compilable in a modern C++ compiler. Maybe he hates a good conio.h - I don't know.
Now I realize there are perfectly good ways of writing in C++, but I'm going for a personal win here by trying to make my C++ version as FORTRAN-esque as possible. For bonus points, this might save me some time and effort when I'm converting code.
SO! This brings me to the following related queries:
On gotos:
- How do you work a goto?
- What are the constraints on gotos in C++?
- Any concerns about scope? (I'm going to try to globally scope as much as possible, but you never know.)
- If I use the GCC extension to goto to a void pointer array, are there any new concerns about undefined behavior, etc?
On longjmp:
- How would you safely use a longjmp?
- What are the constraints on longjmps in C++?
- What does it do to scope?
- Are there any specific moments when it looks like a longjmp should be safe but in fact it isn't that I should watch out for?
- How would I simulate a computed goto with longjmp?
- Is there any tangible benefit to using longjmp over goto if I only have one function in my program?
Right now my main concern is making a computed goto work for this. It looks like I'll probably use the longjmp to make this work because a void pointer array isn't a part of the C++ standard but a GCC specific extension.
goto
is not a reason to close this post! – Baugh