From: Steve T. <te...@te...> - 2003-04-05 06:17:53
|
On Fri, 4 Apr 2003, UNIX savvy Brian Witt wrote: > > I've just submitted another one, this time through sourceforge (#715085). > > This patch+regression gets a lot of function-pointers working: > > I have never seen syntax like that to call through a function pointer. > Here are the two forms I have seen.... > > > pfunc(); // Compiler figures out what to do. > (*pfunc)(); // Explicit about the ptr deref. Quite right; the last is the most accepted form. (Note to self: always reread K&Rv2 before criticizing a C compiler's language acceptance...) All three forms are accepted correctly by SDCC for pointer-to-function-returning-void. But only the last form is accepted for pointer-to-function-returning-char, as in: char c; char (*pfunc)(); char call0(void) { } ... pfunc = call0; c = (pfunc)(); /* error */ c = pfunc(); /* error */ c = (*pfunc)(); /* works */ Gcc accepts 'em all. But that's far from a good test of language conformance. > If there is a regression test, please make sure you include these > two other forms, please. Since I botched attaching the the patch last night, I get to tweak the regression and regenerate it. It now includes all six forms, but the two causing an error are commented. Steve -- Steve Tell te...@te... |