SW500008 Microchip Technology, SW500008 Datasheet - Page 237

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
Library Functions
LONGJMP
Synopsis
Description
The longjmp() function, in conjunction with setjmp(), provides a mechanism for non-local goto’s.
To use this facility, setjmp() should be called with a jmp_buf argument in some outer level function.
The call from setjmp() will return 0.
from an inner level of execution. Note however that the function which called setjmp() must still be
active when longjmp() is called. Breach of this rule will cause disaster, due to the use of a stack
containing invalid data. The val argument to longjmp() will be the value apparently returned from
the setjmp(). This should normally be non-zero, to distinguish it from the genuine setjmp() call.
Example
To return to this level of execution, longjmp() may be called with the same jmp_buf argument
#include <setjmp.h>
void longjmp (jmp_buf buf, int val)
#include <stdio.h>
#include <setjmp.h>
#include <stdlib.h>
jmp_buf jb;
void
inner (void)
{
}
void
main (void)
{
longjmp(jb, 5);
int i;
223

Related parts for SW500008