gcc 1.35 conflicting types message?

David Keppel pardo at june.cs.washington.edu
Sat May 6 05:00:41 AEST 1989


An answer and a question:

ado at elsie.UUCP (Arthur David Olson) writes: (paraphrased)
>gcc v. 1.35 generates a "conflicting types" message
>and refuses to compile when confronted with code such as. . .
>
>	extern int	whatever();
>	extern int	whatever(char * format, ...);

You can generate old and new-style functions declarations by doing
something like

    #ifdef __STDC__
	#define PROTO(x)	x
    #else
	#define PROTO(x)	()
    #endif

    extern int	whatever PROTO((char *format, ...));

Now the question:  I have asserted several times that you cannot
(portably) call between prototyped and non-prototyped code.  Thus, if
a library is compiled without prototypes, you can call it where a
prototyped declaration is in scope.  Similarly, if the thing (library)
was compiled with prototypes, it cannot be called from code that does
not have prototypes in scope.

Thus, the above macros (based on using __STDC__) are broke if you ever
use them to call across compiler types.

Yes?  No?  Maybe so?

	;-D on  ( Your local dime store philosipher )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.std.c mailing list