Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2001 14:09:32 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/usr.bin/jot Makefile jot.c
Message-ID:  <20010528140932.A34999@student.uu.se>
In-Reply-To: <52963.991050595@axl.fw.uunet.co.za>; from sheldonh@starjuice.net on Mon, May 28, 2001 at 01:49:55PM %2B0200
References:  <Pine.BSF.4.21.0105282121480.1612-100000@besplex.bde.org> <52963.991050595@axl.fw.uunet.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 28, 2001 at 01:49:55PM +0200, Sheldon Hearn wrote:
> 
> 
> On Mon, 28 May 2001 21:43:58 +1000, Bruce Evans wrote:
> 
> > > Since when do you have to add a prototype for main()?!
> > 
> > Since -Wmissing-prototypes was added to CFLAGS (by WARNS=2 or BDECFLAGS)
> > to detect the potential error of not declaring extern functions in
> > the right place (which is never in *.c).
> 
> Bleh.  I think this is stupid.  The compiler we use shouldn't force
> us into unnecessary source work-arounds.  Not providing a forward
> declaration for main() is _always_ okay because it's _never_ called by
> any other subroutine in the module.

Are you sure about that ?  Calling main recursively from some function
in your program is perfectly legal in C. It is not allowed in C++
though and it might be considered bad programming style but that is
another question.
I do agree that the compiler should probably treat main() as a special
case to make forward declarations of main() unnecessary.

> 
> David, how would you feel about a local hack to gcc for this?
> 

-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


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?20010528140932.A34999>