c/8754: Allows illegal code

Phil Edwards phil@jaj.com
Wed Dec 4 07:27:00 GMT 2002


On Wed, Dec 04, 2002 at 01:21:18PM +0100, Petter Reinholdtsen wrote:
> > int main()
> > {
> >    double main=3;
> >    return main;
> > }
> 
> OK.  So GCC is not an ANSI C compiler by default.  I would like it to
> be, but I realise the GCC developers do not want that at the moment.

I don't believe ANSI/SIO rules have anything to do with this.

> Could I request a warning by default in the case above, about the
> variable (or local function) hiding the symbol for the current
> function?

It's already there:

    fenric 8% gcc c.c -Wall
    c.c: In function `main':
    c.c:4: warning: `main' is usually a function
    fenric 9%


-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002



More information about the Gcc-bugs mailing list