[SPCA] Finish unorthodox control flow

This commit is contained in:
2026-01-16 08:19:39 +01:00
parent 8ca91096af
commit ad5098bb07
9 changed files with 135 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
#include <setjmp.h>
#include <stdio.h>
static jmp_buf buf;
void second( void ) {
printf( "second\n" );
longjmp( buf, 1 );
}
void first( void ) {
second();
printf( "first\n" ); // Never executed
}
int main() {
if ( !setjmp( buf ) ) // returns 0 initially
first();
else
printf( "main\n" ); // 1 is returned when longjmp is executed
return 0;
}