From owner-freebsd-chat Sun Sep 6 18:00:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA18471 for freebsd-chat-outgoing; Sun, 6 Sep 1998 18:00:08 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from germanium.xtalwind.net (germanium.xtalwind.net [205.160.242.5]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA18454 for ; Sun, 6 Sep 1998 18:00:05 -0700 (PDT) (envelope-from jack@germanium.xtalwind.net) Received: from localhost (jack@localhost) by germanium.xtalwind.net (8.9.1/8.9.1) with SMTP id UAA03675; Sun, 6 Sep 1998 20:59:16 -0400 (EDT) Date: Sun, 6 Sep 1998 20:59:16 -0400 (EDT) From: jack To: Greg Lehey cc: freebsd-chat@FreeBSD.ORG Subject: Re: Where can I find C In-Reply-To: <19980907095317.L25397@freebie.lemis.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 ' 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