[comp.lang.c] assignment question

smiller@umn-cs.cs.umn.edu (Steven M. Miller) (01/19/88)

I'm trying to set up a vector table for a 68020 in C.
For some of the vectors I have external interrupt handlers, for others
I only have addresses for the routines.

I'd like to do the following

void (*vectors[255]();

extern void int_hndlr();

main() {

   vectors[1] = int_hndlr;
   vectors[2] = (void *) 0x1234;

}

Of course my HP cross compiler isn't as forgiving as Sun's C compiler
and the above fails on the second assignment (at compile time that is)

Am I doing something terribly illegal in C or am I just doing what I want to
do incorrectly.

I'll probably end up using straight assembly, but would prefer to avoid it.

Oh yeah, and if I do the opposite, create the array without the () then
the first assignment fails.

-Steve
-- 



			-Steve Miller, U of MN

gwyn@brl-smoke.ARPA (Doug Gwyn ) (01/19/88)

In article <3544@umn-cs.cs.umn.edu> smiller@umn-cs.cs.umn.edu (Steven M. Miller) writes:
>void (*vectors[255]();
>   vectors[2] = (void *) 0x1234;

How about using the right type?

	vectors[2] = (void (*)()) 0x1234;