AT&T C compilers
Guy Harris
guy at auspex.UUCP
Sun Feb 26 10:43:38 AEST 1989
>The AT&T C compiler (from System V, Release 2?) chokes on a declaration
>of the form:
>
>extern int bob(double (*)()) ;
>
>On the other hand, it is accepted by Microsoft C and other C compilers.
(Deep breath, count to 5) Prototypes are a relatively new feature in C
implementations. Some compilers do not support them. The "Portable C
Compiler", upon which many (most?) UNIX C compilers - including the ones
AT&T supplies - are based, does not support them.
>The AT&T C++ translator also chokes on this. Is this declaration
>incorrect, or have I been bitten by a compiler bug?
Neither.
The declaration in question appears to be correct, except that it says
the argument taken by "bob" is a pointer to a function returning
"double", but doesn't say what sort of arguments that function takes. I
think this is legal, however.
This does not mean that there is a bug in the AT&T C compiler, though.
It merely means that the S5R2 C compiler doesn't support function
prototypes.
I don't know whether it's legal C++ or not; if it is, I suspect the
declaration says, in C++, that the function to which the pointer points
takes no arguments (since C++, unlike C, does not have the notion of
"old-style" function declarations where an empty argument list indicates
that the types of the arguments are unknown).
More information about the Comp.lang.c
mailing list