Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!rutgers!att!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: AT&T C compilers Keywords: C compiler,bug? Message-ID: <8972@alice.UUCP> Date: 26 Feb 89 13:13:08 GMT References: <569@marob.MASA.COM> <1071@auspex.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 43 In article <1071@auspex.UUCP>, guy@auspex.UUCP (Guy Harris) writes: [discussion about extern int bob(double (*)()); ] > (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 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. Sure it is -- the arguments of the function are unspecified so it's up to the programmer to get them right when calling it. > 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). Exactly right. It is legal C++, by the way, but presently available C++ translator do not support it -- it is hard to parse. You can achieve the same effect by a semantic hack: typedef (*doublefp)(); extern double bob(doublefp); or by a syntactic hack: extern double bob(auto double(*)()); The (not yet generally available) C++ translator on my machine supports the original form of the declaration just fine, so I imagine it will also be supported by the next version released. -- --Andrew Koenig ark@europa.att.com