Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!hao!hplabs!sri-unix!moss@BRL-VLD.ARPA
From: moss@BRL-VLD.ARPA
Newsgroups: net.lang.c
Subject: Re:  What is the setjump call
Message-ID: <12521@sri-arpa.UUCP>
Date: Mon, 1-Oct-84 09:45:26 EDT
Article-I.D.: sri-arpa.12521
Posted: Mon Oct  1 09:45:26 1984
Date-Received: Thu, 4-Oct-84 04:34:18 EDT
Lines: 43

From:      "Gary S. Moss (AMXBR-VLD-V)" 

Do not use char buf[8] as the storage area for setjmp().  The portable
way is to use the typedef jmp_buf from .  This is defined in
Doug Gwyn's System V emulation as follows;

/*	@(#)setjmp.h	1.3	*/
#ifndef _JBLEN

#if vax || u3b5
#define _JBLEN	10
#endif

#if pdp11
#define _JBLEN	4	/* DAG -- one larger for overlays */
#endif

#if u370
#define _JBLEN	4
#endif

#if u3b
#define _JBLEN	11
#endif

typedef int jmp_buf[_JBLEN];

extern int setjmp();
extern void longjmp();

#endif

The size of the buffer differs with machine and version of UNIX and the
whim of whoever modifies the compiler, so USE THE TYPEDEF BY INCLUDING
SETJMP.H!!!

I got bit by this one because I defined it as int buf[3] rather than
including .  Since my buffer was one integer short, I stomped
on an integer variable when I called setjmp(), and Boy was that a tough
bug to track down.

-- Moss.
PS, I know this was not your question.