Function returning twice

From Cppwiki

Jump to: navigation, search

A few special-purpose function in C and C++ can return twice, instead of once like a normal function. An example is std::setjmp (which is standard C99 and POSIX, but not C++): setjmp returns once, when first called, and returns again--that is, control jumps back to immediately after the point of return--if longjmp is called later. Functions which return twice cause special problems for compilers and optimisers, and often need to be specially annotated to work correctly (for example, using GCC attributes).

Personal tools