difference between c89 and c99

Erik Trulsson ertr1013 at student.uu.se
Tue May 29 23:24:01 UTC 2007


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 at student.uu.se


More information about the freebsd-questions mailing list