Date: Sun, 6 Sep 1998 20:59:16 -0400 (EDT) From: jack <jack@germanium.xtalwind.net> To: Greg Lehey <grog@lemis.com> Cc: freebsd-chat@FreeBSD.ORG Subject: Re: Where can I find C Message-ID: <Pine.BSF.4.02A.9809062048330.3596-100000@germanium.xtalwind.net> In-Reply-To: <19980907095317.L25397@freebie.lemis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 7 Sep 1998, Greg Lehey wrote:
> On Sunday, 6 September 1998 at 12:40:06 +0200, Jens Schweikhardt wrote:
> > # On Sat, 5 Sep 1998, Dusk Auriel Sykotik wrote:
> > # > On Fri, 4 Sep 1998, Scott Sewall wrote:
> > # > > main () {
> > # > > printf("Hello World!\n");
> > # > > }
> > # > You can't use printf(), you didn't include stdio.h :)
> >
> > hello, world\n
> >
> > # Nah, it'll draw a warning, perhaps .... but this is perfectly legal C.
> >
> > What did you smoke tonight? :-)
>
> K&R fiirst edition?
>
> > You call a variadic function with no prototype in scope
> > which leads to undefined behaviour as per ISO 9899:1990
> > This bombs as soon as the representation of int and char *
> > are different or if there are different passing mechanisms
> > for those types.
>
> You're obviously very young, or you place too much trust in
> ``standards''. The *very* first program in "The C programming
> language", by Brian W. Kernighan and Dennis M. Ritchie, first edition
> (1978), page 6, is:
>
> main()
> {
> printf("hello, world\n");
> }
>
> That's all. No header files, no comments. Purists will note that the
> the braces are not in K&R style (they are in the previous example),
> that the message is lower case only and does not bang.
In the second edition (1988) `#include <stdio.h>' is part of that
listing, and it is in that brace style. However, the include
file is not required.
germanium:jack {116} echo 'main(){printf("Hello World!\n");}' >
hello.c
germanium:jack {117} cc -o hello hello.c
germanium:jack {118} ./hello
Hello World!
germanium:jack {119} cc -v
gcc version 2.7.2.1
No warning, no errors, no core dumps.
> > Note that only the spelling of hello, world\n as above is correct :-)
>
> I didn't think it was standardized.
Same results as above with either spelling. :)
--------------------------------------------------------------------------
Jack O'Neill Systems Administrator / Systems Analyst
jack@germanium.xtalwind.net Crystal Wind Communications, Inc.
Finger jack@germanium.xtalwind.net for my PGP key.
PGP Key fingerprint = F6 C4 E6 D4 2F 15 A7 67 FD 09 E9 3C 5F CC EB CD
enriched, vcard, HTML messages > /dev/null
--------------------------------------------------------------------------
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?Pine.BSF.4.02A.9809062048330.3596-100000>
