Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 用户手册
产品代码
SW006021-1
Library Functions
2012 Microchip Technology Inc.
DS52053B-page 357
SETJMP
Synopsis
#include <setjmp.h>
int setjmp (jmp_buf buf)
Description
The
setjmp()
function is used with longjmp() for non-local goto’s. See longjmp()
for further information.
Example
#include <stdio.h>
#include <setjmp.h>
#include <stdlib.h>
jmp_buf jb;
void
inner (void)
{
longjmp(jb, 5);
}
void
main (void)
{
int i;
if(i = setjmp(jb)) {
printf("setjmp returned %d\n", i);
exit(0);
}
printf("setjmp returned 0 - good\n");
printf("calling inner...\n");
inner();
printf("inner returned - bad!\n");
}
See Also
longjmp()
Return Value
The
setjmp()
function returns zero after the real call, and non-zero if it apparently
returns after a call to longjmp().
SIN
Synopsis
#include <math.h>
double sin (double f)
Description
This function returns the sine function of its argument.