From owner-freebsd-questions@FreeBSD.ORG Tue May 29 23:24:01 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7C91716A400 for ; Tue, 29 May 2007 23:24:01 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id 0CB6213C4AE for ; Tue, 29 May 2007 23:24:00 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-10-135.bredband.comhem.se ([83.253.10.135]:61787 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.66) (envelope-from ) id 1HtB2m-0006Wd-3i for freebsd-questions@freebsd.org; Wed, 30 May 2007 01:24:00 +0200 Received: (qmail 35911 invoked from network); 30 May 2007 01:23:57 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with SMTP; 30 May 2007 01:23:57 +0200 Received: (qmail 62747 invoked by uid 1001); 30 May 2007 01:23:57 +0200 Date: Wed, 30 May 2007 01:23:57 +0200 From: Erik Trulsson To: FreeBSD Questions Message-ID: <20070529232357.GA62621@owl.midgard.homeip.net> Mail-Followup-To: FreeBSD Questions References: <20070529222617.GA39269@demeter.hydra> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070529222617.GA39269@demeter.hydra> User-Agent: Mutt/1.5.14 (2007-02-12) X-Originating-IP: 83.253.10.135 X-ACL-Warn: Too high rate of unknown addresses received from you X-Scan-Result: No virus found in message 1HtB2m-0006Wd-3i. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1HtB2m-0006Wd-3i 31143f27afe26c7b071aff694bdb8c7c Subject: Re: difference between c89 and c99 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2007 23:24:01 -0000 On Tue, May 29, 2007 at 04:26:18PM -0600, Chad Perrin wrote: > It has been years since I've worked with the C programming language at > all, and I've forgotten most of what little I knew then. Now that I'm > starting to look into learning C (again-ish), for purposes of perhaps > contributing code to some FreeBSD projects, I find myself staring at > the available compilers in the base system for FreeBSD and wondering at > the differences. Any information I can get on the subject would be much > appreciated. > > For instance: > > What's the difference between c89 and c99? > > Is there any reason to avoid c*9 in favor of gcc (or vice versa) when > working on FreeBSD projects? > > Please don't necessarily limit yourself to these questions if/when you > choose to give me an answer. /usr/bin/c89 and /usr/bin/c99 are both just wrappers around gcc. As far as I can tell the main reason for the existence of these wrappers is to be compliant with the POSIX standard which mandates that these commands exist. The intent appears to be that c89 invokes a C compiler that complies with the original ANSI C standard from 1989 while c99 invokes a compiler that complies with the revised C standard from 1999 (aka C99.) If you want to be resonably portable then just use 'cc' which on almost all Unix-like systems refer to the systems default C compiler - whichever it happens to be. (On FreeBSD it is gcc.) In case it is not completely clear from the above: There is only one C compiler included in the FreeBSD base system and that is gcc. -- Erik Trulsson ertr1013@student.uu.se