Namensräume
Varianten
Aktionen

std::longjmp

Aus cppreference.com
< cpp‎ | utility‎ | program

 
 
 
Das Programm unterstützt Versorgungsunternehmen
Beendigung des Programms
Original:
Program termination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
abort
exit
quick_exit(C++11)
_Exit(C++11)
Die Kommunikation mit der Umwelt
Original:
Communicating with the environment
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Signale
Original:
Signals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Signal-Typen
Original:
Signal types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
Nicht-lokale Sprünge
Original:
Non-local jumps
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
setjmp
longjmp
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
jmp_buf
 
Defined in header <csetjmp>
void longjmp( std::jmp_buf env, int status );
Lasten der Ausführungskontext env durch einen früheren Aufruf setjmp gespeichert. Diese Funktion ist nicht zurückkehren. Steuerung wird an den Call-site des Makros setjmp, die Einrichtung env übertragen. Das setjmp gibt dann den Wert, wie die status übergeben .
Original:
Loads the execution context env saved by a previous call to setjmp. This function does not return. Control is transferred to the call site of the macro setjmp that set up env. That setjmp then returns the value, passed as the status.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn die Funktion, die setjmp genannt verlassen hat, ist das Verhalten undefiniert (in anderen Worten, nur lange springt der Aufrufliste sind erlaubt)
Original:
If the function that called setjmp has exited, the behavior is undefined (in other words, only long jumps up the call stack are allowed)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Keine Destruktoren für die automatische Objekten aufgerufen werden. Wenn das Ersetzen der std::longjmp mit throw und setjmp mit catch würde eine nicht-trivialen Destruktor für jede automatische Objekt auszuführen, ist das Verhalten solcher std::longjmp undefined .
Original:
No destructors for automatic objects are called. If replacing of std::longjmp with throw and setjmp with catch would execute a non-trivial destructor for any automatic object, the behavior of such std::longjmp is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Parameter

env -
Variable bezogen auf den Ausführungszustand des Programms durch std::setjmp gespeichert
Original:
variable referring to the execution state of the program saved by std::setjmp
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
status -
der Wert von setjmp zurückzukehren. Wenn es gleich 0 ist, wird 1 stattdessen verwendet
Original:
the value to return from setjmp. If it is equal to 0, 1 is used instead
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Rückgabewert

(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

#include <iostream>
#include <csetjmp>
 
std::jmp_buf jump_buffer;
 
[[noreturn]] void a(int count) 
{
    std::cout << "a(" << count << ") called\n";
    std::longjmp(jump_buffer, count+1);  // setjump() will return count+1
}
 
int main()
{
    int count = setjmp(jump_buffer);
    if (count != 9) {
        a(count);  // This will cause setjmp() to exit
    }
}

Output:

a(0) called
a(1) called
a(2) called
a(3) called
a(4) called
a(5) called
a(6) called
a(7) called
a(8) called

[Bearbeiten] Siehe auch

spart den Kontext
Original:
saves the context
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funktionieren Makro) [edit]
C documentation for longjmp