Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Dec 2001 16:04:43 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "David O'Brien" <obrien@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Mark Murray <mark@grondar.za>, Luigi Rizzo <rizzo@aciri.org>, Garance A Drosihn <drosih@rpi.edu>
Subject:   Re: Are prototypes for main() illegal by any standard ? (was Re:
Message-ID:  <XFMail.011216160443.jhb@FreeBSD.org>
In-Reply-To: <20011216075240.A29455@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 16-Dec-01 David O'Brien wrote:
> On Sat, Dec 15, 2001 at 05:53:49PM -0500, Garance A Drosihn wrote:
>> If adding the prototype for main() does *break* something, then it
>> would be helpful to find out what it is that breaks.
> 
> main() is special.  The C compiler knows it returns an int and for us,
> can take up to three arguments.  Because the prototype for main() is set
> in stone, that is why the user should not supply one.  Lest they will
> prototype it as "void main (float, char *[])".
> 
> We would not add a prototype for printf() in a program, we would include
> stdio.h instead.  This is the same with main() except rather than it
> being prototyped in a header, it is prototyped w/in the compiler.
> 
> This is comming up due to a bug in a single compiler.  We have fixed that
> compiler.  AFAIK the other two compilers we use at all today -- TenDRA
> and Compaq's compiler does not have this bug.  So why change all this
> code when we fixed things at the source of the problem?

Agreed.  Requesting prototypes for main is the compiler bug, not hiding the
warning for main.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011216160443.jhb>