Xref: utzoo gnu.gcc.bug:1046 gnu.gcc:500 comp.std.c:1157 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!ames!haven!mimsy!tank!eecae!cps3xx!rang From: rang@cpsin3.cps.msu.edu (Anton Rang) Newsgroups: gnu.gcc.bug,gnu.gcc,comp.std.c Subject: Re: gcc 1.35 conflicting types message? Message-ID: <2867@cps3xx.UUCP> Date: 6 May 89 02:15:21 GMT References: <9101@elsie.UUCP> <8124@june.cs.washington.edu> Sender: usenet@cps3xx.UUCP Reply-To: rang@cpswh.cps.msu.edu (Anton Rang) Organization: Michigan State University, Computer Science Dept. Lines: 52 In article <8124@june.cs.washington.edu> pardo@june.cs.washington.edu (David Keppel) writes: >An answer and a question: >ado@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 " and then "#include ", 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@cpswh.cps.msu.edu | rec.music.newage! | +---------------------------+------------------------+-------------------+ | Send votes for/against rec.music.newage to "rang@cpswh.cps.msu.edu". | +---------------------------+------------------------+-------------------+