Difference between C89 and C99?

J

Jason Curl

I've seen the document N869.txt and the copy I could find talks about
C99. Is there anything that comprehensively describes the difference
between C89 and C99? I'd like to write code to be as portable as possible.

Thanks,
Jason.
 
C

Chris Hills

Jason Curl said:
I've seen the document N869.txt and the copy I could find talks about
C99. Is there anything that comprehensively describes the difference
between C89 and C99? I'd like to write code to be as portable as possible.

Thanks,
Jason.

K&R 1st ed was the original C description from the 1970's
It is now obsolete as regards being the C language specification.

K&R 2nd Ed pub 1988 their book update to C89
C89 is an ANSI standard from dated 1989
C90 is the ISO version and the first International C standard
These three should be the same. K&R were on the ANSI panel that
produced [ANSI] C89 and that became ISO-C90

There have been various Amendments and TC's in 93,4,5 etc

In 1999 there was a new version of the ISO-C standard. C99.
The problem is that despite 2 TC's to C99 there are no conforming
compilers for it. Most are part way between C90 and C99.

If you want to write portable C I would use C99 with A1 and the TC's It
is where (AFAIK) most of the compilers are at. Of course it depends what
you are writing and what sort of portability you want. For portability
there could be far more important issues than sticking to ISO-C

BTW
You should not be using any N*** document as these are committee working
documents and therefore not accurate. They have been superseded by the
published standard and will not include any/some/all changes (if any)
after the reviews.

Buy the standard if you want to work to it. Using an N*** document is
like trying to write a legal document using a dictionary which may have
an arbitrary number of spelling mistakes and incorrect definitions in
it.



/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/\
/\/\/ (e-mail address removed) www.phaedsys.org \/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
 
L

lawrence.jones

Jason Curl said:
I've seen the document N869.txt and the copy I could find talks about
C99. Is there anything that comprehensively describes the difference
between C89 and C99? I'd like to write code to be as portable as possible.

There's a brief listing of the new features in the Foreword of the C99
standard. The list is reproduced on the committee's web site:

<http://www.open-std.org/jtc1/sc22/wg14/www/newinc9x.htm>

-Larry Jones

All girls should be shipped to Pluto--that's what I say. -- Calvin
 
C

CBFalconer

Chris said:
.... snip ...

BTW
You should not be using any N*** document as these are committee
working documents and therefore not accurate. They have been
superseded by the published standard and will not include
any/some/all changes (if any) after the reviews.

Buy the standard if you want to work to it. Using an N***
document is like trying to write a legal document using a
dictionary which may have an arbitrary number of spelling
mistakes and incorrect definitions in it.

However N869 is quite adequate for most purposes, as long as you
are willing to recognize the failings. It has the great advantage
of having a text version, which the actual standard still fails to
supply. A text version can be searched and manipulated with
ordinary tools. Why ISO/ANSI refused to publish an official text
version is beyond comprehension.
 
C

Chris Croughton

However N869 is quite adequate for most purposes, as long as you
are willing to recognize the failings. It has the great advantage
of having a text version, which the actual standard still fails to
supply. A text version can be searched and manipulated with
ordinary tools. Why ISO/ANSI refused to publish an official text
version is beyond comprehension.

Because they want to sell the PDF one to you as many times as possible?
With their licence I can't even have a copy on my desktop and one on my
laptop without paying twice. One of the standards (I don't remember if
it's the C or the C++ one) won't even allow copy to clipboard, it's in
some protected format.

It's the same with the BSI standards, they want to charge lots of money
for them, text would be too easy to distribute...

(Has anyone produced a list of the differences between N869 and the
standard? I wonder if there actually are any significant ones, or
whether the "it's not accurate" is in fact FUD aimed at trying to sell
the standard...)

Personally I want my code to be portable, so I'm not knowingly using any
extensions later than C89, there are too many compilers and libraries
which aren't fully implementing C99 (and worse they each fail to
implement different bits). Yes, it would be lovely if everything was up
to date, but in the real world it isn't...

Chris C
 
E

Eric Sosman

Chris said:
Because they want to sell the PDF one to you as many times as possible?
With their licence I can't even have a copy on my desktop and one on my
laptop without paying twice. One of the standards (I don't remember if
it's the C or the C++ one) won't even allow copy to clipboard, it's in
some protected format.

If ANSI sold you a text version *under the exact same
license conditions,* would that make a difference in your
behavior? (If you're a United States citizen you need not
answer; there's this nice little loophole called the Fifth
Amendment to the Constitution, which says you cannot be
required to incriminate yourself ;-)

This strand of the thread seems to be straying from
topicality on comp.lang.c; comp.std.c might be a better
forum.
 
D

Default User

CBFalconer said:
However N869 is quite adequate for most purposes, as long as you
are willing to recognize the failings. It has the great advantage
of having a text version, which the actual standard still fails to
supply. A text version can be searched and manipulated with
ordinary tools. Why ISO/ANSI refused to publish an official text
version is beyond comprehension.


This has been discussed many times in the past few years. Dan Pop was
of the opinion that N869 was just fine. There are non-trivial
differences, but if you make a mistake here based on one of those
differences someone will gleefully point it out. Then you can annotate
your copy so you don't make that mistake again. Of course, Dan was of
the opinion that he knew more C without an offical copy of the Standard
than some did *with* one.

Mostly we use the Standards for argumentation. I am sure some of you
are using the Standard daily for Very Important Work. You need not tell
me that.



Brian
 
J

Jason Curl

CBFalconer said:
Chris Hills wrote:

.... snip ...



However N869 is quite adequate for most purposes, as long as you
are willing to recognize the failings. It has the great advantage
of having a text version, which the actual standard still fails to
supply. A text version can be searched and manipulated with
ordinary tools. Why ISO/ANSI refused to publish an official text
version is beyond comprehension.

Probably the biggest interest is the different definitions of the
library. I would write all syntax using C89/90 as this is guaranteed to
work with C99 as well. The interesting bits would be what new
libraries/functions are available in C99 that aren't in C89?

Then using my development environment I can write functions for C99, and
test using a configuration script that can test if a particular set up
has a C99 implementation for a function or not.

Thanks for all comments.
 
J

Jason Curl

Chris said:
Jason Curl said:
I've seen the document N869.txt and the copy I could find talks about
C99. Is there anything that comprehensively describes the difference
between C89 and C99? I'd like to write code to be as portable as possible.

Thanks,
Jason.


K&R 1st ed was the original C description from the 1970's
It is now obsolete as regards being the C language specification.

K&R 2nd Ed pub 1988 their book update to C89
C89 is an ANSI standard from dated 1989
C90 is the ISO version and the first International C standard
These three should be the same. K&R were on the ANSI panel that
produced [ANSI] C89 and that became ISO-C90

There have been various Amendments and TC's in 93,4,5 etc

In 1999 there was a new version of the ISO-C standard. C99.
The problem is that despite 2 TC's to C99 there are no conforming
compilers for it. Most are part way between C90 and C99.

If you want to write portable C I would use C99 with A1 and the TC's It
is where (AFAIK) most of the compilers are at. Of course it depends what
you are writing and what sort of portability you want. For portability
there could be far more important issues than sticking to ISO-C

BTW
You should not be using any N*** document as these are committee working
documents and therefore not accurate. They have been superseded by the
published standard and will not include any/some/all changes (if any)
after the reviews.

Buy the standard if you want to work to it. Using an N*** document is
like trying to write a legal document using a dictionary which may have
an arbitrary number of spelling mistakes and incorrect definitions in
it.

Does the C99 standard differentiate between what's also in C89 and
what's new?
 
C

Chris Croughton

If ANSI sold you a text version *under the exact same
license conditions,* would that make a difference in your
behavior? (If you're a United States citizen you need not
answer; there's this nice little loophole called the Fifth
Amendment to the Constitution, which says you cannot be
required to incriminate yourself ;-)

"I'll take the Fifth." "Make mine a double!" <g>

My own behaviour? Probably not. But having it in a proprietary format
which allows protection does make it more difficult for those people who
do want to copy chunks into other formats.
This strand of the thread seems to be straying from
topicality on comp.lang.c; comp.std.c might be a better
forum.

Although it's not about Standard C, it's about the attitude of standards
bodies in general. Which is probably not on topic anywhere in comp.*...

Chris C
 
M

Michael Wojcik

The problem is that despite 2 TC's to C99 there are no conforming
compilers for it. Most are part way between C90 and C99.

You keep making this claim, Chris, but I've yet to see any evidence
from you that the implementations which do claim C99 compliance are
not in fact conforming. I can think of at least three such implemen-
tations being cited here:

- Comeau C plus the Dinkumware libraries
- Edison Design Group C plus the Dinkumware libraries
- HP Compaq C for OpenVMS for Alpha

Some others that claim conformance:

- IBM C for AIX v6
- Intel C v8, except for FP_CONTRACT, FENV_ACCESS, and
CX_LIMITED_RANGE
- Lund Multiprocessor Complier Company LMPCC C99 v1.3

EDG+Dinkumware and LMPCC have received CVSA certificates.

So, if you have evidence that none of these is conforming, please let
us know; and if not, you might want to try to be a little more
accurate in your claims.

Really, is it that much harder to say "C99 conforming implementations
are rare"?

--
Michael Wojcik (e-mail address removed)

She felt increasingly (vision or nightmare?) that, though people are
important, the relations between them are not, and that in particular
too much fuss has been made over marriage; centuries of carnal
embracement, yet man is no nearer to understanding man. -- E M Forster
 
C

CBFalconer

Jason said:
CBFalconer wrote:
.... snip ...

Probably the biggest interest is the different definitions of the
library. I would write all syntax using C89/90 as this is guaranteed
to work with C99 as well. The interesting bits would be what new
libraries/functions are available in C99 that aren't in C89?

The worst omission known to me is the absence of vsnprintf (or
something similar) in N869.
 
E

E. Robert Tisdale

Michael said:
You keep making this claim, Chris,
but I've yet to see any evidence from you
that the implementations which do claim C99 compliance
are not in fact conforming.
I can think of at least three such implementations being cited here:

- Comeau C plus the Dinkumware libraries
- Edison Design Group C plus the Dinkumware libraries
- HP Compaq C for OpenVMS for Alpha

Some others that claim conformance:

- IBM C for AIX v6
- Intel C v8, except for FP_CONTRACT, FENV_ACCESS, and
CX_LIMITED_RANGE
- Lund Multiprocessor Complier Company LMPCC C99 v1.3

EDG+Dinkumware and LMPCC have received CVSA certificates.

So, if you have evidence that none of these is conforming,
please let us know; and if not,
you might want to try to be a little more accurate in your claims.

Really, is it that much harder to say
"C99 conforming implementations are rare"?

What does "rare" mean?
It appears that you can get a C99 conforming compiler
for just about every platform that C programmers target.
If you want to be *accurate*, you should say,
"C99 conforming implementations are ubiquitous."

I don't think that the resistance to the new standard
has anything to do with the availability of conforming compilers.
It's just an "olde fogyism".
Like everybody else, C programmers fear change as they get older.
They have resisted change and will continue to resist change
and younger programmers will just have to work around them
until they retire or die.
 
K

Keith Thompson

E. Robert Tisdale said:
What does "rare" mean?
It appears that you can get a C99 conforming compiler
for just about every platform that C programmers target.
If you want to be *accurate*, you should say,
"C99 conforming implementations are ubiquitous."

I hardly think that they're "ubiquitous". I know of some platforms
that are not likely *ever* to have a conforming C99 compiler (though
they're not platforms that most of you are likely to use), and the
most widespread C implementation, gcc, is not fully conforming (for
example, variable-length arrays, complex and imaginary support, and
inline functions are still marked as "broken", even in gcc 4.0.0).
 
M

Mark McIntyre

"I'll take the Fifth." "Make mine a double!" <g>

Remind me: does the international copyright convention still allow
'fair use' ? If so, ANSI's method of distribution would seem to be
illegal if it prevents copying of small chunks of text.
 
L

lawrence.jones

CBFalconer said:
Why ISO/ANSI refused to publish an official text
version is beyond comprehension.

Because quite a lot of information is lost in translation -- much of the
typesetting is significant (e.g., italicized terms are definitions) and
the mathematical equations are not easily represented in plain text.
Although it would certainly be possible to create a usable text version,
it would require far more work than the volunteer editor is willing to
expend.

-Larry Jones

I've got an idea for a sit-com called "Father Knows Zilch." -- Calvin
 
L

lawrence.jones

Chris Croughton said:
Because they want to sell the PDF one to you as many times as possible?

Yes, that $18 sure adds up quick.
(Has anyone produced a list of the differences between N869 and the
standard? I wonder if there actually are any significant ones, or
whether the "it's not accurate" is in fact FUD aimed at trying to sell
the standard...)

Yes, there are significant changes. No, I don't know of any exhaustive
list.

-Larry Jones

Bad news, Mom. I promised my soul to the Devil this afternoon. -- Calvin
 
L

lawrence.jones

Chris Hills said:
K&R were on the ANSI panel that
produced [ANSI] C89 and that became ISO-C90

No, they weren't. K is primarily a writer and presumably wasn't
interested. R deliberately chose not to participate for fear of
exerting undue influence on the committee.

-Larry Jones

Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. -- Calvin
 
K

Keith Thompson

Mark McIntyre said:
Remind me: does the international copyright convention still allow
'fair use' ?

As far as I know it does, but I can't comment definitively.
If so, ANSI's method of distribution would seem to be
illegal if it prevents copying of small chunks of text.

It's perfectly legal to distribute documents on paper, which makes it
even more difficult to copy small chunks of text than a protected PDF
document does. I don't think that copyright law requires the
copyright owner to make such copying easy (but of course IANAL).

For what it's worth, my PDF copy of the C99 standard (purchased from
ANSI) does allow copy-and-paste.
 
A

Alan Balmer

Remind me: does the international copyright convention still allow
'fair use' ?
If so, ANSI's method of distribution would seem to be
illegal if it prevents copying of small chunks of text.

Copy and paste from the C99 standard (legally purchased PDF copy):
********
This International Standard specifies the form and establishes the
interpretation of
programs written in the C programming language.1) It specifies
********

Maybe the C++ standard? In any case, I don't know that it would be
illegal to prevent copying of "fair use" portions. Copy protection of
one kind or another has been used for many years on copyrighted
material. They might have to allow you to copy it, they don't have to
enable you to copy it. It's up to you to figure out how. Anyway, it
seems that "fair use" is now subservient to the DMCA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top