Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Akim Demaille <demaille@gargantua.enst.fr>
Subject: Re: Bug in CC? (OSF1 4.0)
Date: 1997/10/21	[thread overview]
Message-ID: <qyl67qrzalr.fsf@gargantua.enst.fr> (raw)
In-Reply-To: qyl3elwq0ig.fsf@gargantua.enst.fr


Akim Demaille <demaille@gargantua.enst.fr> writes:

> 		Hi !
> 
> 	One of the problems I encounter is a weird behavior of native
> cc.  On the attached file (cc -E of the file giving problems), I get
> the following problems:
> 
> $ cc foo.c -c
> cc: Error: foo.c, line 534: In this declaration, the type of
> "ds_strccat" is not compatible with the type of a previous declaration
> of "ds_strccat" at line number 339 in file foo.c.
> ds_strccat (struct dstring *s, char c)
> ^
> 
> 	The line 534 is
> void /* 533 */
> ds_strccat (struct dstring *s, char c)
> 
> 	and 339 is
> 
> void ds_strccat ();

	Several persons answered my question.  I thank them a lot, and
apologize for my mistake.  Weirdness was purely due to my
miscomprehension of mixed KnR and ANSI style.

	Everything comes from the fact that :

- my does-the-compiler-handle-prototypes macros were ill defined,
  removing prototypes to often,
- I thought there were no problems with that.

	It appears that only two functions in the file I sent were
using char as parameters, but leaving undefined the arguments in the
prototype resulted in having them defaulted to an int type.

	It breaks on char (and short int, floats I guess, etc.).  Any
compiler would have behaved this way.

	To fix my problem I only had to fix my prototypes defining
macros so that they... work :).

Once again, thanks a lot to those who answered.

	Akim

PS/ I have a question then: how would a KnR compiler would have
behaved?

-- 
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 (1) 45-81-78-68



      parent reply	other threads:[~1997-10-21  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-20  4:00 Bug in CC? (OSF1 4.0) Akim Demaille
1997-10-20  4:00 ` Rich Peterson
1997-10-21  4:00 ` Akim Demaille [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox