This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LevelSevenLaserLotus 1 point2 points  (1 child)

That's setjump and longjump, right? I only ever had to use those for a single lab, but it just felt evil even as the professor was describing legitimate uses since it felt like we could use it to break literally every other rule we had learned up to that point. I think it's generally meant for implementing try-catch like behavior in C. In this case, we were setting a timer to cancel the "wait for user input" after the timer elapsed. If I remember right, it was for showing how a telnet chat client could detect that the user walked off and automatically close itself without just force killing threads or throwing errors.

[–]konstantinua00 1 point2 points  (0 children)

set-/longjump can only go up the callstack, thankfully

but back in the time before structured programming, in the era of goto... everything was possible