Date: Wed, 30 May 2007 01:23:57 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: difference between c89 and c99 Message-ID: <20070529232357.GA62621@owl.midgard.homeip.net> In-Reply-To: <20070529222617.GA39269@demeter.hydra> References: <20070529222617.GA39269@demeter.hydra>
next in thread | previous in thread | raw e-mail | index | archive | help
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. -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070529232357.GA62621>