473,883 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C99 Versus ANSI.

Hi All

What is C99 Standard is all about. is it portable, i mean i saw
-std=C99 option in GCC
but there is no such thing in VC++.?

which one is better ANSI C / C99?
can i know the major difference between C99 & ANSI C standards?

Sep 27 '06
83 11664
jacob navia said:

<snip>
If you ignore pedantic people, there are MANY more. Intel's, gcc, and
many others are almost 100% conformant. A few irrelevant issues are
a justification fgor pedantic people to scream "NO, there is NONE"

Just ignore them
Be very wary of any implementor who thinks pedantry is a Bad Thing.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 27 '06 #31
jacob navia <ja***@jacob.re mcomp.frwrites:
Harald van Dijk wrote:
>Richard Heathfield wrote:
>>>jacob navia said:
and under windows there is intel compiler,

Got a URL? All I could find on their site were C++ compilers.
The "Intel C++ Compiler" is a less than perfect name; ICC includes
separate C and C++ compilers. I don't know if it's a conforming
implementation , though; from their own site:
http://www.intel.com/support/perform.../cs-015003.htm
C Standard Conformance
The Intel® C++ Compilers provide some conformance to the ANSI/ISO
standard for C language compilation (ISO/IEC 9899:1999).
For more information on C conformance, refer to the User's Guide.
"Some conformance" ? (In fairness though, I don't know of any issues
icc may have that would make it nonconforming.)

It is business talk.

If you write

This is 100% conforming you are liable if there is the
slightest bug. If you write "some" conformance, you are
not.
Or you might write "some conformance" if you know that your compiler
isn't fully conforming.

If you have some actual knowledge about the Intel compiler's C99
conformance, beyond what's on the web page, perhaps you could share it
with the rest of us. Intel's statement of "some conformance"
certainly isn't enough for us to assume that it's fully conforming.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 27 '06 #32
jacob navia <ja***@jacob.re mcomp.frwrites:
Harald van Dijk wrote:
>Richard Heathfield wrote:
[...]
>>>So far, then, we have exactly ZERO conforming implementations of C99. So
much for that.
You mean one, right? IBM's? It was mentioned in this thread, and from
http://www-306.ibm.com/software/awdt...cpp/features/:
"The C and the C++ compilers conform to the latest ISO/IEC
Internationa l Standards. The C compiler supports the latest ISO C 1999
(Internation al Standard ISO/IEC 9899:1999) standard, also known as C99."

If you ignore pedantic people, there are MANY more. Intel's, gcc, and
many others are almost 100% conformant. A few irrelevant issues are
a justification fgor pedantic people to scream "NO, there is NONE"

Just ignore them
If you ignore pedantic people, you're unlikely to learn anything.

Who are you to decide which issues are irrelevant?

If you want to tell us that some compiler supports most of C99, that's
fine. If you tell us, without qualification, that it supports C99,
and in fact it fails to support some C99 features (such as designated
initializers, structure initializers with the dot notation, and macros
with variable argument lists), then your statement is at best
incomplete, and at worst simply untrue.

As I said elsethread, a conforming C90 compiler is *nearly* a
conforming C99 compiler; C90 is most of C99. If I were to claim that
"gcc -ansi -pedantic" is a C99 compiler (with an unstated assumption
that the features that are in C99 but not in C90 are not
"significan t"), I doubt that you would take my statement seriously.

You can write portable conforming C99 code today, simply by avoiding
any C99-specific features. (Such code is also portable conforming C90
code.)

You're a compiler implementer. You *should* be pedantic.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 27 '06 #33
"Harald van Dijk" <tr*****@gmail. comwrites:
Keith Thompson wrote:
>I don't believe that Intel's compiler fully supports C99. If you can
demonstrate that it does, please do so.

Having just tested it, I can demonstrate that it does not.

$ cat test.c
int main (void)
{
printf ("Hello, world!\n");
}
$ icc --version
icc (ICC) 9.1 20060816
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

$ icc -strict-ansi -c99 -Wall test.c -o test
$ ./test
Hello, world!

(C99 requires a diagnostic for syntax errors, and undeclared
identifiers are a syntax error.)
It's a constraint violation, not a syntax error, but both constraint
violations and syntax errors require diagnostics.

Perhaps there's some other set of command-line options that cause icc
to be (more nearly) conforming?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 27 '06 #34
Keith Thompson wrote:
"Harald van Dijk" <tr*****@gmail. comwrites:
Keith Thompson wrote:
I don't believe that Intel's compiler fully supports C99. If you can
demonstrate that it does, please do so.
Having just tested it, I can demonstrate that it does not.

$ cat test.c
int main (void)
{
printf ("Hello, world!\n");
}
$ icc --version
icc (ICC) 9.1 20060816
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.

$ icc -strict-ansi -c99 -Wall test.c -o test
$ ./test
Hello, world!

(C99 requires a diagnostic for syntax errors, and undeclared
identifiers are a syntax error.)

It's a constraint violation, not a syntax error, but both constraint
violations and syntax errors require diagnostics.
6.5.1p2:
An identifier is a primary expression, provided it has been declared
as designating an
object (in which case it is an lvalue) or a function (in which case it
is a function
designator).77)

77) Thus, an undeclared identifier is a violation of the syntax.
Perhaps there's some other set of command-line options that cause icc
to be (more nearly) conforming?
According to the documentation, -strict-ansi -c99 is enough to get icc
to (attempt to) conform to C99. Does the standard require that an
implementation accurately describe how to invoke it in a conforming
mode?

Sep 27 '06 #35
On Wed, 27 Sep 2006 21:33:15 +0200, jacob navia
<ja***@jacob.re mcomp.frwrote:
>If you ignore pedantic people, there are MANY more.
If you ignore pedantic people, than you will have only an approximate
knowledge of real things. "Almost 100% conformant" is simpy NOT
conformant, so the answer "NO, there is NONE" is really correct if all
the compilers available are ALMOST 100% conformant.
Sep 27 '06 #36
"Harald van Dijk" <tr*****@gmail. comwrites:
Keith Thompson wrote:
>"Harald van Dijk" <tr*****@gmail. comwrites:
[...]
(C99 requires a diagnostic for syntax errors, and undeclared
identifiers are a syntax error.)

It's a constraint violation, not a syntax error, but both constraint
violations and syntax errors require diagnostics.

6.5.1p2:
An identifier is a primary expression, provided it has been declared
as designating an object (in which case it is an lvalue) or a
function (in which case it is a function designator).77)

77) Thus, an undeclared identifier is a violation of the syntax.
Interesting. I'll have to take a closer look at that. (My copy of
the standard isn't available at the moment.)

I certainly think of using an undeclared identifier as a semantic
error rather than a syntax error, but sometimes the standard foolishly
disagrees with me. 8-)}
>Perhaps there's some other set of command-line options that cause icc
to be (more nearly) conforming?

According to the documentation, -strict-ansi -c99 is enough to get icc
to (attempt to) conform to C99. Does the standard require that an
implementation accurately describe how to invoke it in a conforming
mode?
Interesting question.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 27 '06 #37
jacob navia wrote:
If you ignore pedantic people
When were you appointed as the person who gets to draw the line between
what's "pedantic" and what's just plain wrong?
Sep 28 '06 #38
jacob navia wrote:
It is business talk.

If you write

This is 100% conforming you are liable if there is the
slightest bug. If you write "some" conformance, you are
not.
Oh really? You think the FSF is afraid of being sued?
Sep 28 '06 #39
Keith Thompson <ks***@mib.orgw rites:
"Harald van Dijk" <tr*****@gmail. comwrites:
>Keith Thompson wrote:
>>"Harald van Dijk" <tr*****@gmail. comwrites:
[...]
>(C99 requires a diagnostic for syntax errors, and undeclared
identifiers are a syntax error.)

It's a constraint violation, not a syntax error, but both constraint
violations and syntax errors require diagnostics.

6.5.1p2:
An identifier is a primary expression, provided it has been declared
as designating an object (in which case it is an lvalue) or a
function (in which case it is a function designator).77)

77) Thus, an undeclared identifier is a violation of the syntax.

Interesting. I'll have to take a closer look at that. (My copy of
the standard isn't available at the moment.)

I certainly think of using an undeclared identifier as a semantic
error rather than a syntax error, but sometimes the standard foolishly
disagrees with me. 8-)}
[...]

Yes, the standard agrees with your. (I didn't doubt your quotation, I
just wanted to look at the context.) But I would still question the
way the standard says this.

With a bit more context:

6.5.1 Primary expressions

Syntax

1 primary-expression:
identifier
constant
string-literal
( expression )

Semantics

2 An identifier is a primary expression, provided it has been
declared as designating an object (in which case it is an lvalue)
or a function (in which case it is a function designator).77)

[...]

77) Thus, an undeclared identifier is a violation of the syntax.

So the "Syntax" section clearly says that an identifier is a primary
expression, but the "Semantics" section says this applies only if it's
been declared as designating an object or a function. It's odd that
the "Syntax" section doesn't completely describe the syntax; it seems
to me it would have been more sensible to say that an identifier is
always a primary expression, and the use of an undeclared identifier
is a semantic error, not a syntax error. (Sometimes an aspect of the
syntax can be more easily stated in English rather than in BNF, but it
doesn't seem necessary in this case.)

But as I said, sometimes the standard foolishly disagrees with me. 8-)}

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 28 '06 #40

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.