Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: AT&T C compilers Keywords: C compiler,bug? Message-ID: <1071@auspex.UUCP> Date: 26 Feb 89 00:43:38 GMT References: <569@marob.MASA.COM> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 32 >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).