Compiler bug
Barry Shein
root at bu-cs.UUCP
Wed May 8 07:30:11 AEST 1985
>From: jss at sjuvax.UUCP (J. Shapiro)
>I recently noticed that the following will not compile correctly on a
>4.2 BSD system:
>extern int usr1(), usr2(), usr3();
>int usrprocs[] = { usr1, usr2, usr3 }
>...
Would someone be good enough to check this out on a sysV machine?
I believe it won't compile because it's wrong, try:
extern int usr1(), usr2(), usr3() ;
int (*usrprocs[])() = { usr1, usr2, usr3 } ;
ie. that isn't an array of ints, it's an array of pointers to
functions returning int (phew.) If other compilers aren't
complaining, they're being lazy and not doing their job.
Confusing ints with pointers is a classic port problem.
-Barry Shein, Boston University
More information about the Comp.unix
mailing list