Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Sep 1998 21:56:43 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Charles Youse <cyouse@artemis.syncom.net>
Cc:        Dusk Auriel Sykotik <syko@sykotik.org>, chat@FreeBSD.ORG
Subject:   Re: Where can I find C
Message-ID:  <199809060156.VAA21373@khavrinen.lcs.mit.edu>
In-Reply-To: <Pine.NEB.3.96.980905204054.25315A-100000@artemis.syncom.net>
References:  <Pine.LNX.3.95.980905200113.30275A-100000@vortex.starix.net> <Pine.NEB.3.96.980905204054.25315A-100000@artemis.syncom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Sat, 5 Sep 1998 20:43:32 -0400 (EDT), Charles Youse <cyouse@artemis.syncom.net> said:

[Redirected to the correct list.]

> Nah, it'll draw a warning, perhaps .... but this is perfectly legal C.

>> You can't use printf(), you didn't include stdio.h :)

Mr. Whazisname is correct.  Standard C does not permit variadic
functions to be called without a declaration in scope.  The minimal
hello, world program in C would be:

------------------------------------
int printf(const char *, ...); /* supply correct prototype */
int
main(void) /* as a special exception, main is allowed to take no args */
{
	printf("Hello, World!\n");
	return 0;	/* main MUST return a value if it returns at all */
}
------------------------------------

I don't recall whether a non-prototype declaration is permitted for
variadic functions.  I think it is, but would not be surprised to see
non-prototype declarations dropped completely from C 99.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick

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



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