5

gcc 4.4.1

I am just wondering which standard is better and more portable?

I was doing some research on this. And found that c89 is still widely used more than c99. Not many C developers are switching to the newer c99 standard.

And also, is c89 more portable than c99?

As c99 has been around for me than 10 years. I would have thought it would be used more than the c89 standard and be just as portable?

Many thanks for any suggestions,

ant2009
  • 27,094
  • 154
  • 411
  • 609

5 Answers5

7

Unfortunately C89 is more portable. Microsoft are not planning to add c99 support to VS2010 (Although they do support some features). GCC is far better, but still not 100% compliant with the standard

Wikipedia has more information on other implementations.

Yacoby
  • 54,544
  • 15
  • 116
  • 120
3

YES. C89 is more portable than C99.

Here is a discussion on the C99 support on different platforms and compilers.

Community
  • 1
  • 1
Yin Zhu
  • 16,980
  • 13
  • 75
  • 117
3

The C99 standard is "better" in the sense that it is more up-to-date, and offers useful features not found in C89 (VLAs, compound literals, restrict keyword, improved math library, etc.). It is not as widely supported as C89, because C89 is "good enough" for most jobs, and there isn't the overwhelming demand to move to the new standard like there was when C89 came out (the improvements C99 offers over C89 are fairly incremental, whereas the improvements of C89 over K&R C were significant).

John Bode
  • 119,563
  • 19
  • 122
  • 198
1

Not sure what better means, but generally you want to follow the newer standard, which might help to produce better, more reliable code.

user231967
  • 1,935
  • 11
  • 9
1

c89 + #ifdefs are the way to go.

I'm using Sun Studio 11 and like it. It is fully c99 conform but only targets Linux and Solaris. I don't know any other popular full c99 compliant compiler and i just looked up wikipedia which tells me the same.

If you need embedded systems there is almost no hope to have widespread support even for partial support.

Lothar
  • 12,537
  • 6
  • 72
  • 121