From: utzoo!decvax!harpo!seismo!rlgvax!guy Newsgroups: net.unix-wizards Title: Re: Problem with function returning pointer to function of type void Article-I.D.: rlgvax.204 Posted: Fri Apr 8 23:54:26 1983 Received: Sun Apr 10 01:00:16 1983 References: sri-arpa.824 Why does ----- float i=97.; float *g() { return &i; } float *(*f())() { return g; } main() { printf("%g\n",*(*f())()); } ----- work (printing "97"), when ----- void g() { printf("hi\n"); } void (*f())() { return g; } main() { (*f())(); } ----- fails to compile, giving the error message line 2: operands of RETURN have incompatible types ? Because the System III C compiler (which also happens to be the 4.1BSD C compiler, for all you trivia freaks out there), and possibly other variants of PCC, mishandle "void". It is a complicated mishandling, I looked into it a long time ago, and I have since forgotten exactly what the problem is. It also looked complicated to fix. It involves the way that certain type bits are used in PCC and the fact that (if I remember correctly) certain bits don't get turned on for functions returning "void", and PCC gets confused about the type of the function. That's what happens when you graft a feature (like "void") onto something which didn't anticipate it... Guy Harris RLG Corporation {seismo,mcnc,we13}!rlgvax!guy