Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!imagen!daemon From: jfinger@apolling (Jeff Finger) Newsgroups: comp.sys.apollo Subject: SR10.1 BUG/MISFEATURE: typedefs Message-ID: <4756@imagen.UUCP> Date: 15 Nov 89 20:26:07 GMT Article-I.D.: imagen.4756 Sender: daemon@imagen.UUCP Lines: 56 ################################################################ Following is an example of a legal use of ANSI C function prototypes -- a typedef specifying a class of functions of identical type (including argument types). Unfortunately, this program cannot be compiled under SR10.1. Although Apollo's support of ANSI C is admittedly only partial, I believe that giving an error on the program below is either a serious bug or serious misfeature. At the worst, the compiler should give an incorrect warning message rather than claim a type mismatch. -- Jeff Finger -- jfinger@imagen.com jfinger@neon.stanford.edu ################################################################ % cat fred.c typedef short fred_fp( long ); extern fred_fp fred; extern void main( void ); short fred( nbytes ) long nbytes; { return( 37 ); } void main() { short x; x = fred( 43 ); } ##################################################################### # # Note that gcc 1.33 compiles it ok, but Apollo SR10.1 CC does not. # Apollo CC's handling of typedefs does not seem to have remembered # the formal parameter types. # ##################################################################### % gcc -ansi -Wall -c fred.c % cc -v -c fred.c -g-W0,-info 1 (0009) long nbytes; ******** Line 8 of "fred.c": [Error #258] Multiple declaration of "fred". (0017) x = fred( 43 ); ******** Line 17 of "fred.c": [Warning #078] Incompatible pointer and integer operands [x, fred] to the "=" operator.