On Tue, 2006-08-15 at 10:06 -0700, Joe Buck wrote:
> On Mon, Aug 14, 2006 at 08:38:38PM -0400, Pavel Roskin wrote:
> > On Mon, 2006-08-14 at 22:44 +0200, Andreas Schwab wrote:
> > > Try -Werror-implicit-function-declaration.  Not the same, but pretty
> > > close.
> > 
> > Thanks!  I know.  In fact, I'm using at least "-Wall -Werror" for my
> > code and for the code I'm working with, so it's implied.  I'm talking
> > about code that I have never seen until the binary did a poo-poo on my
> > machine.
> > 
> > Sure, I can petition Fedora, Novell, Debian and others to use
> > -Werror-implicit-function-declaration, but I don't think I'll have
> > convincing arguments.
> 
> You seem to think that if GCC gets stricter about rejecting bad code,
> things will get magically better and software distributions will produce
> better code.  It tends not to work that way, and the attempt will just
> cause the sloppier distros to delay upgrading to new gcc versions.

That's unfortunate.  Although it's hard to imagine that is would stop
Fedora.

> The basic problem is the unfortunate "implicit int" rule from K&R C that
> we still haven't killed.  And your proposed solution, in my view, is a
> hack.  You want to detect the one case where a result of an implicit int
> function is converted into a pointer, and treat this as a hard error while
> still giving only a warning for the conversion of some other int into a
> pointer (even though these other conversions may also be 64-bit bugs).

The thing is, one can call the function properly, using 0 for integers,
0L for longs and NULL for pointers, and gcc will do the right thing (I
think so).  In the same time, using the function result "properly", i.e.
placing a pointer into a pointer variable, will not work.

Anyway, it was just an idea from an outsider, and I'm not going to argue
too much about it.

-- 
Regards,
Pavel Roskin


Reply via email to