Questions about C90 vs C99

D

dspfun

Hi!

I am trying to understand weather to use c89/c90 or c99 and have come
up with some questions that I would be interested in hearing your
thoughts about:

What is the advantage of writing a program according to c90? Dito for
c99?

What is the disadvantage of asking someone to write a program
according to c90 instead of c99? Dito for "c99 instead of c90"?

What do you recommend when giving programming assignmnts/jobs: "write
the program according to c90" or "write the program according c99"?

As far as I understand the best (best as being most portable) thing is
to write C-programs that comply with c89, c90 and c99.

How are C-compilers "officially certified" to comply with c89, c90 and
c99?

BRs!
 
T

Tomás Ó hÉilidhe

Is C90 not a subset of C99?


Not entirely, C99 got rid of implicit int and also implicit function
declarations for instance, and that's because they were anti-features in
the first place.
 
D

Default User

Tomas said:
Not entirely, C99 got rid of implicit int and also implicit function
declarations for instance, and that's because they were anti-features
in the first place.

Yep. Most of what you "lose" weren't good practices anyway.




Brian
 
J

jameskuyper

dspfun said:
Hi!

I am trying to understand weather to use c89/c90 or c99 and have come
up with some questions that I would be interested in hearing your
thoughts about:

What is the advantage of writing a program according to c90? Dito for
c99?

Writing for C90:
Compilable on virtually every implementation of C in existence.

Writing for C99:
You can take advantage of the new features of C99.
What is the disadvantage of asking someone to write a program
according to c90 instead of c99? Dito for "c99 instead of c90"?

Writing for C90:
You can't use the new features of C99.

Writing for C99:
Not all of the new features of C99 are fully implemented in widely
available implementations of C. However, most of them are.
What do you recommend when giving programming assignmnts/jobs: "write
the program according to c90" or "write the program according c99"?

I would favor C99. The features that are not yet widely implemented
can be avoided, and the ones that have been widely implemented will
probably be universally implemented in the not-to-distant future.
As far as I understand the best (best as being most portable) thing is
to write C-programs that comply with c89, c90 and c99.

That's the safest approach. I don't agree that it's "best" in all
circumstances. In some cases the advantage of being able to take
advantage of the new features of C99 is more important than the small
number of platforms where your code won't compile correctly.
How are C-compilers "officially certified" to comply with c89, c90 and
c99?

There's no official certification process. A number of private
companies provide test suites which can check for non-compliance.
Note: advertising copy to the contrary not-withstanding, it's not
possible to prove that a given implmentation is conforming; it's only
possible to prove that it's non-conforming. However, if you perform
enough tests for non-conformance on an implementation, and it passes
all of them, you can place some level of confidence in the idea that
it's conforming.

However, from the descriptions I've been given of these test suites,
it seems that many of them read between the lines of the standard and
interpret it as making stronger requirements than it actually makes.
What these tests really check for is whether the compiler conforms to
the standard with acceptable quality-of-implementation (QoI), which is
an important thing to know. My objection is only to the fact that
those test suites reportedly incorrectly label low-quality but fully
conforming implementations as being non-conforming.

I can't verify this from personal experience; those test suites are
not needed for my job, and are too expensive to justify buying for my
home computer.
 
M

Mark McIntyre

dspfun said:
What is the advantage of writing a program according to c90? Dito for
c99?

C90 is currently supported on a wider range of platforms.
C99 has some new features which you may find convenient.
What is the disadvantage of asking someone to write a program
according to c90 instead of c99? Dito for "c99 instead of c90"?

Hmm, sounds like a homework question...
What do you recommend when giving programming assignmnts/jobs: "write
the program according to c90" or "write the program according c99"?

"Write according to the capabilities of the compiler you have available
for the platforms you're targetting."
and
"Try to keep platform-specfific code separate from Standard C, but don't
get obsessive about it."
How are C-compilers "officially certified" to comply with c89, c90 and
c99?

Self-certification as far as I know.
 
T

Tor Rustad

dspfun wrote:
[...]
How are C-compilers "officially certified" to comply with c89, c90 and
c99?

There's no official certification process. A number of private
companies provide test suites which can check for non-compliance.

Well, we do have the UNIX 03 certification, which comes with a validated
C99 compiler.

"ISO-C the requested output files from a valid release of either the
Perennial or Plum Hall test suites."
- http://www.opengroup.org/openbrand/testing/checklist/u03brand.html

IIRC, from the last time I checked, there was some 3-4 validated C99
compilers.
 
K

Keith Thompson

Tomás Ó hÉilidhe said:
Not entirely, C99 got rid of implicit int and also implicit function
declarations for instance, and that's because they were anti-features in
the first place.

And of course C99 adds a few new keywords, which are no longer
available for use as ordinary identifiers (inline, restrict).
 
R

Richard Tobin

And of course C99 adds a few new keywords, which are no longer
available for use as ordinary identifiers (inline, restrict).

One of which (inline) I actually ran into the other day. The error
message wasn't very enlightening.

-- Richard
 
J

James Kuyper

dspfun said:
Is there an official certification process for C89 or C90?

For the standards themselves? I presume the answer is yes, though I
don't know the details. ISO has standards that prescribe how ISO
standards are supposed to be written, and I would expect that ISO is
sufficiently bureaucratic that it actually enforces those standards. ISO
has no external enforcement powers, but the standards that govern other
ISO standards are a purely internal affair.
 
D

dspfun

For the standards themselves? I presume the answer is yes, though I
don't know the details. ISO has standards that prescribe how ISO
standards are supposed to be written, and I would expect that ISO is
sufficiently bureaucratic that it actually enforces those standards. ISO
has no external enforcement powers, but the standards that govern other
ISO standards are a purely internal affair.

Ok, thanks! What I meant was if there is/was an official certification
process for C89/C90 compilers.
 
J

jameskuyper

dspfun said:
....
Ok, thanks! What I meant was if there is/was an official certification
process for C89/C90 compilers.

??? - I already answered that question, and you've quoted my answer
above, just before repeating the question. That's why I assumed that
you had to be asking a different question.
 
D

dspfun

??? - I already answered that question, and you've quoted my answer
above, just before repeating the question. That's why I assumed that
you had to be asking a different question.

Ok, I wasn't sure if you meant your answer was valid for all (C89, C90
and C99). Now I know, thanks!
 
N

Nick Keighley

I am trying to understand weather to use c89/c90 or c99 and have come
up with some questions that I would be interested in hearing your
thoughts about:

What is the advantage of writing a program according to c90?
portability

Dito for c99?

shiney new features

What is the disadvantage of asking someone to write a program
according to c90 instead of c99? Dito for "c99 instead of c90"?

What do you recommend when giving programming assignmnts/jobs: "write
the program according to c90" or "write the program according c99"?

As far as I understand the best (best as being most portable) thing is
to write C-programs that comply with c89, c90 and c99.

I encourage people to use C90. If some feature of C99 was *really*
needed (rather than a convenience) (eg. complex numbers) then I'd
recomend C99 (or maybe C++...)

<snip>


--
Nick Keighley

Q: How many surrealists does it take to change a light bulb?
A: Two. One to hold the giraffe and the other to fill the bathtub
with
brightly colored machine tools.
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top