gcc 1.35 conflicting types message?

Anton Rang rang at cpsin3.cps.msu.edu
Sat May 6 12:15:21 AEST 1989


In article <8124 at june.cs.washington.edu> pardo at june.cs.washington.edu (David Keppel) writes:

>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, ...));

  This works fine when you are writing your own functions.  I think
the problem that Mr. Olson was referring to was when you are trying to
add prototypes to standard libraries.  At least, that's the problem
I'm facing here--if you do "#include <stdio.h>" and then "#include
<proto/stdio.h>", our system (Sun-3/280) will prototype the calls
there.  I haven't gotten 1.35 up yet, but if the above error message
occurs in this situation, it means we have to either (1) give up
support for the standard C compiler, or (2) duplicate all the include
files, then edit them to use prototypes instead of externs.

>Now the question:  I have asserted several times that you cannot
>(portably) call between prototyped and non-prototyped code.

  In which cases would this be true?  The only time I can see it is if
you have a prototype which overrides a default type conversion; i.e.
if you have a function

	char *func(x)
	  char x;

then the obvious prototype "char *func(char x)" would be wrong.  Doing
the promotion gives you the prototype "char *func(int x)".  Is there
anything wrong with this that I'm missing?

+---------------------------+------------------------+-------------------+
| Anton Rang (grad student) | "VMS Forever!"         | VOTE on	         |
| Michigan State University | rang at cpswh.cps.msu.edu | rec.music.newage! |
+---------------------------+------------------------+-------------------+
| Send votes for/against rec.music.newage to "rang at cpswh.cps.msu.edu".   |
+---------------------------+------------------------+-------------------+



More information about the Comp.std.c mailing list