[comp.lang.c] Problem with C compiler

talvola@cory.Berkeley.EDU (Erik Talvola) (06/10/89)

In trying to compile a program on an HP workstation here at Berkeley
(HP 9000/200 series), I ran into a problem with the C compiler.  I have
the following lines of code:

static void default_new_handler ();
void (*__new_handler)() = default_new_handler;

This gets an error that the operands of = have incompatible types.  This
is very annoying.  I can't put a cast on the right hand side, or else it
gets an error about an illegal cast.  This compiles fine on a Sun 3/50 with
the stock compiler - but not with the HP one.  Does anyone have any ideas
on how I can work around this?  I have tried several things and none of
them work.  Declarations of function pointers work, but I can assign to
them something which is a function.

Many thanks in advance...

---------------------------+
Erik Talvola               | "It's just what we need... a colossal negative 
talvola@cory.berkeley.edu  | space wedgie of great power coming right at us
..!ucbvax!cory!talvola    | at warp speed." -- Star Drek

maart@cs.vu.nl (Maarten Litmaath) (06/10/89)

talvola@cory.Berkeley.EDU (Erik Talvola) writes:
\...
\static void default_new_handler ();
\void (*__new_handler)() = default_new_handler;

\This gets an error that the operands of = have incompatible types.

This is a known bug. Temporary solution: cc -Dvoid=int. Send a bug report to
your vendor.
-- 
 "Your password [should be] like your |Maarten Litmaath @ VU Amsterdam:
      toothbrush." (Don Alvarez)      |maart@cs.vu.nl, mcvax!botter!maart