Address of array

greg at utcsri greg at utcsri
Fri Apr 25 20:07:00 AEST 1986


In article <153 at brl-smoke.ARPA> gwyn at BRL.ARPA writes:
>typedef struct { whatever-you-need } jmp_buf[1];
>
>solves the problem of the way setjmp()'s parameter is used,
>with completely type-correct implementation (in the
>"whatever-you-need" part).  Too bad setjmp() was defined
>as taking an array parameter in the first place.

I've been wondering about this... Why would you need to define jmp_buf
as a structure? It seems (1) it is impossible to write setjump or
longjmp in C (2) the contents of the buffer are completely
non-portable, so any program that looks at or alters them is
non-portable (3) you can't do anything useful with them anyway, from C.
All jmp_buf is is a certain amount of space, as far as C needs to be
concerned. I think point (3) is a bit shaky - the contents just might
be useful in certain inherently non-portable code. And it would be
nice, I agree, if jmp_buf had been defined as a structure - if only to
allow easy copying of jmp_buf records. A definition might look like
`typedef struct{ char *dummy[11];} jmp_buf;'.  But are there cases where
a structure was used out of necessity?

-- 
"For every action there is an equal and opposite malfunction"
----------------------------------------------------------------------
Greg Smith     University of Toronto      UUCP: ..utzoo!utcsri!greg



More information about the Comp.lang.c mailing list