Date: Sat, 10 Mar 2001 23:58:51 -0600 From: Andrew Hesford <ajh3@chmod.ath.cx> To: Tyler K McGeorge <treznor@sunflower.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: ANSI/ISO C99 or C89? Message-ID: <20010310235851.A42299@cec.wustl.edu> In-Reply-To: <000501c0a9e6$ffc44940$103b7c18@palisor.yi.org>; from treznor@sunflower.com on Sat, Mar 10, 2001 at 10:51:55PM -0600 References: <000501c0a9e6$ffc44940$103b7c18@palisor.yi.org>
next in thread | previous in thread | raw e-mail | index | archive | help
GCC 2.95.2, which is part of the base FreeBSD system (in contrib or somewhere like that), is largely noncompliant with C99. I believe certain aspects are supported, but not any that I've found significant. You will have a hard time finding compliant compilers right now. C99 was only recently ratified as ISO/ANSI, so it will take time for stable code to be assimilated into a release-quality compiler. Expect to wait a while on GCC; if I'm not mistaken, their release period is growing increasingly longer. If you are just learning C, I'd suggest you focus on the old ANSI-C first. No doubt the vast majority of information available pertains to C89, plus C89 enforces better coding practice. The features in C99 are nice and cushy, but can lead to broken code if used unwisely. An example comes to mind: variable-length arrays. C does not have array bounds checking, which means the use of variable-length arrays in programs will lead to more frequent boundary overruns. Such feature is present in Java and C++, but Java has built-in variable bounds checking (I am unaware of how this is handled in C++). You would be wise to learn the old methods of staticly-sized arrays and everybody's friends, malloc, realloc and free, before jumping in with unguarded variable-length arrays. Enjoy your programming experience. On Sat, Mar 10, 2001 at 10:51:55PM -0600, Tyler K McGeorge wrote: > I have searched (briefly) several man pages to determine whether gcc is C99 > compliant. I've read in literature that some compilers/linkers are not C99 > compliant, but allow for some of the conventions used. > > I'm sure somebody out there knows. And if gcc isn't, is there a different > compiler I should be using? Do it come standard (I'm using FreeBSD > 4.2-RELEASE)? Is it in ports? I'm just now delving into my C phase. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Andrew Hesford ajh3@chmod.ath.cx To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010310235851.A42299>