Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!cuae2!ihnp4!houxm!mtuxo!mtune!mtung!ijk From: ijk@mtung.UUCP (Ihor Kinal) Newsgroups: net.lang.c Subject: pointers to void () vs. ptr to int () with conditional ops Message-ID: <742@mtung.UUCP> Date: Mon, 21-Jul-86 14:17:26 EDT Article-I.D.: mtung.742 Posted: Mon Jul 21 14:17:26 1986 Date-Received: Tue, 22-Jul-86 00:51:08 EDT Distribution: net Organization: AT&T ISL Middletown NJ USA Lines: 62 The following code does not compile with line 21, yet the equivalent code using if-else is OK, and the conditional works with int functions. Is my lint and compiler broken, or am I overlooking something? Thanks, Ihor Kinal ihnp4!mtung!ijk /* sample program using conditionals and pointers to functions */ extern int func_i(); extern int func_J(); extern void func_v(); extern void func_W(); main() { int (*iptr_to_func) (); void (*vptr_to_func) (); int index = 3; iptr_to_func = (index == 0) ? func_i : func_J; if (index == 1) vptr_to_func = func_v; else vptr_to_func = func_W; vptr_to_func = (index == 1) ? func_v : func_W; } /* following output from lint: tst.c ============== (21) operands of : have incompatible types (14) warning: iptr_to_ set but not used in function main (21) warning: vptr_to_ set but not used in function main warning: illegal combination of pointer and integer: (21) operator = ============== name used but not defined func_J tst.c(14) func_W tst.c(21) func_i tst.c(14) func_v tst.c(21) ------- END of lint output --------------- ******* following output from cc: "tst.c", line 21: operands of : have incompatible types "tst.c", line 21: warning: illegal combination of pointer and integer, op = */