[net.lang.c] a use for &LABEL

djm@nmtvax.UUCP (09/27/84)

[here, have a nice salad, bug]

	I can think of one use for &LABEL, having run into it recently.
The situation is that I need to set a hardware interrupt vector to
enter into the middle of a function.  Now, the obvious thing to do is

A) create a new function (weird overheads on my micro preclude this)
B) vector = &placetogo

Am I missing something, or is this a legitimate situation?  (Actually,
it IS a legit problem, is there some other solution?)

My system is an Apple w/ the Manx C compiler.  I admit I haven't read
all of the manual yet, but I haven't seen anything that applied.
x
	Dieter Muller
	{lanl | unmvax}!nmtvax!djm

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/28/84)

It is unlikely that you will like the results of an interrupt jumping
into the middle of your C code.  For one thing, this bypasses the stack
frame set-up so your auto variables will be stolen from whatever stack
frame happens to be set at interrupt time.  The preferred way to handle
interrupts with C functions is to write a little assembly-language
interface that saves all registers etc. and calls the C function with
valid arguments, then restores the machine state before RTI.  Your Manx
C system includes an assembler that can be used for this.