Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 10:48:56 +0200
From:      Mark Murray <mark@grondar.za>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        "David O'Brien" <obrien@FreeBSD.org>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, 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:  <200112180848.fBI8mvO00685@grimreaper.grondar.org>
In-Reply-To: <XFMail.011216160443.jhb@FreeBSD.org> ; from John Baldwin <jhb@FreeBSD.org>  "Sun, 16 Dec 2001 16:04:43 PST."
References:  <XFMail.011216160443.jhb@FreeBSD.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.

This I do not understand. :-)

AFAIK, this is perfectly legal C:

/* begin */
void printf(char *, ...)

void main(void)
{
	printf("Hello world");
}
/* end */

And it should compile warning-free and run without error. Agreed
that the style sucks, but it is _legal_ - and any compiler's prior
assumed knowledge about main is plain wrong - it is a linker thing
to use ``main'' as an entry point, and nobody else's damn business
what it is after that! (argc and argv are likewise conventions that
are less useful in an embedded environment with no shell (ya, ya I
know about execv :)).

Now if anyone can show official standards showing me that I'm
wrong here, I'll shut up and back off. :-)

M
-- 
o       Mark Murray
\_      FreeBSD Services Limited
O.\_    Warning: this .sig is umop ap!sdn

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?200112180848.fBI8mvO00685>