Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Reason for ISO ; warning

Reply
Thread Tools

Reason for ISO ; warning

 
 
Richard Tobin
Guest
Posts: n/a
 
      12-07-2005
In article <dn70b4$4s3$(E-Mail Removed)>, pemo <(E-Mail Removed)> wrote:
>Ah, ok, so is -ansi the ANSI variant then?


There isn't an "ANSI variant". ANSI standardised C in 1989. ISO
adopted that definition in 1990. ISO produced another standard in
1999, which (apparently) ANSI adopted in 2000. So ANSI C is the same
as ISO C, and the versions can be referred to as C89 and C00 or C90
and C99 depending on which standards body you prefer.

-- Richard
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      12-07-2005
Ian Malone said:

> That gcc option means ISO C99, there is no ANSI C99, which seems to be
> what R Heathfield was getting at.


Sorry I wasn't clear. I was actually trying to get two points across at the
same time, always a bad idea.

The first point was that the C99 switch in gcc is a bit optimistic. gcc does
not fully support the new Standard, no matter what you choose to call it.

The second point was about what you choose to call it!, and that has now
been explained ad nauseam.

--
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)
 
Reply With Quote
 
 
 
 
pemo
Guest
Posts: n/a
 
      12-07-2005

"Richard Tobin" <(E-Mail Removed)> wrote in message
news:dn70rj$s8m$(E-Mail Removed)...
> In article <dn70b4$4s3$(E-Mail Removed)>, pemo <(E-Mail Removed)>
> wrote:
>>Ah, ok, so is -ansi the ANSI variant then?

>
> There isn't an "ANSI variant". ANSI standardised C in 1989. ISO
> adopted that definition in 1990. ISO produced another standard in
> 1999, which (apparently) ANSI adopted in 2000. So ANSI C is the same
> as ISO C, and the versions can be referred to as C89 and C00 or C90
> and C99 depending on which standards body you prefer.


Sorry, not what I meant as a question [my fault], it was more what -ansi
*means* as a gcc switch.

OT here of course, but for completeness - here's what the manual says...

The original ANSI C standard (X3.159-1989) was ratified in 1989 and
published in 1990.
This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later in
1990. There
were no technical differences between these publications, although the
sections of the ANSI
standard were renumbered and became clauses in the ISO standard. This
standard, in
both its forms, is commonly known as C89, or occasionally as C90, from the
dates of
ratification. The ANSI standard, but not the ISO standard, also came with a
Rationale
document. To select this standard in GCC, use one of the options '-ansi',
'-std=c89' or
'-std=iso9899:1990';


 
Reply With Quote
 
Clark S. Cox III
Guest
Posts: n/a
 
      12-07-2005
On 2005-12-07 11:22:27 -0500, "pemo" <(E-Mail Removed)> said:

>
> "Richard Tobin" <(E-Mail Removed)> wrote in message
> news:dn70rj$s8m$(E-Mail Removed)...
>> In article <dn70b4$4s3$(E-Mail Removed)>, pemo <(E-Mail Removed)> wrote:
>>> Ah, ok, so is -ansi the ANSI variant then?

>>
>> There isn't an "ANSI variant". ANSI standardised C in 1989. ISO
>> adopted that definition in 1990. ISO produced another standard in
>> 1999, which (apparently) ANSI adopted in 2000. So ANSI C is the same
>> as ISO C, and the versions can be referred to as C89 and C00 or C90
>> and C99 depending on which standards body you prefer.

>
> Sorry, not what I meant as a question [my fault], it was more what
> -ansi *means* as a gcc switch.
>
> OT here of course, but for completeness - here's what the manual says...
>
> The original ANSI C standard (X3.159-1989) was ratified in 1989 and
> published in 1990.
> This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later
> in 1990. There
> were no technical differences between these publications, although the
> sections of the ANSI
> standard were renumbered and became clauses in the ISO standard. This
> standard, in
> both its forms, is commonly known as C89, or occasionally as C90, from
> the dates of
> ratification. The ANSI standard, but not the ISO standard, also came
> with a Rationale
> document. To select this standard in GCC, use one of the options
> '-ansi', '-std=c89' or
> '-std=iso9899:1990';


Well, the manual just told you; '-ansi' means the same as '-std=c89' or
'-std=iso9899:1990'

--
Clark S. Cox, III
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
pemo
Guest
Posts: n/a
 
      12-07-2005

"Clark S. Cox III" <(E-Mail Removed)> wrote in message
news:2005120711335216807-clarkcox3@gmailcom...
> On 2005-12-07 11:22:27 -0500, "pemo" <(E-Mail Removed)> said:
>
>>
>> "Richard Tobin" <(E-Mail Removed)> wrote in message
>> news:dn70rj$s8m$(E-Mail Removed)...
>>> In article <dn70b4$4s3$(E-Mail Removed)>, pemo <(E-Mail Removed)>
>>> wrote:
>>>> Ah, ok, so is -ansi the ANSI variant then?
>>>
>>> There isn't an "ANSI variant". ANSI standardised C in 1989. ISO
>>> adopted that definition in 1990. ISO produced another standard in
>>> 1999, which (apparently) ANSI adopted in 2000. So ANSI C is the same
>>> as ISO C, and the versions can be referred to as C89 and C00 or C90
>>> and C99 depending on which standards body you prefer.

>>
>> Sorry, not what I meant as a question [my fault], it was more what -ansi
>> *means* as a gcc switch.
>>
>> OT here of course, but for completeness - here's what the manual says...
>>
>> The original ANSI C standard (X3.159-1989) was ratified in 1989 and
>> published in 1990.
>> This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later
>> in 1990. There
>> were no technical differences between these publications, although the
>> sections of the ANSI
>> standard were renumbered and became clauses in the ISO standard. This
>> standard, in
>> both its forms, is commonly known as C89, or occasionally as C90, from
>> the dates of
>> ratification. The ANSI standard, but not the ISO standard, also came with
>> a Rationale
>> document. To select this standard in GCC, use one of the options '-ansi',
>> '-std=c89' or
>> '-std=iso9899:1990';

>
> Well, the manual just told you; '-ansi' means the same as '-std=c89' or
> '-std=iso9899:1990'


Um, yeah, I noticed! But thanks for pointing it out.


 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      12-07-2005
"pemo" <(E-Mail Removed)> writes:
> [Warning] ISO C does not allow extra ';' outside of a function
>
> int n;;
>
> int main(void)
> {
> ...
> }
>
> Anyone care to enlighten me as to why ISO C does not allow this, but
> apparently ANSI c99 does?


If "int n;;" appeared inside a function, it would be a declaration
"int n;" followed by an empty statement ";". Since the grammar
doesn't allow statements outside functions, "int n;;" outside a
function is an error.

As far as I know, this didn't change between C90 and C99; gcc seems to
agree:

% cat tmp.c
int x;;
% gcc --version | head -1
gcc (GCC) 4.0.2
% gcc -c -pedantic -std=c89 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=iso9899:1990 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=iso9899:199409 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=c99 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=c9x tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=iso9899:1999 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function
% gcc -c -pedantic -std=iso9899:1999 tmp.c
tmp.c:1: warning: ISO C does not allow extra ';' outside of a function

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <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.
 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      12-08-2005
On Wed, 7 Dec 2005 15:48:53 +0000 (UTC), Richard Heathfield
<(E-Mail Removed)> wrote in comp.lang.c:

> pemo said:
>
> > the message came from gcc and appears
> > with -Wall -pedantic -std=c99

>
> Despite the flag name, gcc does not fully support C99.
>
> > So, I assume c99 is what you're caling c00?

>
> If you mean the ISO C Standard, it's C99. If you mean the ANSI C Standard,
> it's C00.
>
> 1989: ANSI C (C89).
> 1990: ISO C (C90) - this is effectively identical to C89, the only changes I
> know about being section number changes.
> 1995: There was a minor mod to the Standard which, I believe, was adopted by
> both ISO and ANSI.
> 1999: ISO C (C99).
> 2000: ANSI C (C00 or C2000) - this is effectively identical to C99.
>
> Most people use C89 when they mean either C89 or C90, and C99 when they mean
> either C99 or C00/C2000 - despite the fact that C89 refers to the ANSI
> Standard and C99 refers to the ISO Standard.


Sheesh, you are not only beating a dead horse, you are beating it
incorrectly. The ANSI delegation to ISO voted to ratify the 1999
version of the C standard at the same time that all other the member
national standard bodies, except for the British who voted against it,
did.

Due to a procedural issue, meaning somebody at ANSI objected,
ratification as an American National Standard required sending it out
to their members as a vote. It was officially approved as an American
National Standard on May 15, 2000.

Nevertheless, if you point your favorite browser to:

http://webstore.ansi.org/ansidocstor...EC+9899%2D1999

....you will see that for the princely sum of $18.00USD, you can still
purchase:

Document#: INCITS/ISO/IEC 9899-1999
Title: Programming Languages - C (formerly ANSI/ISO/IEC
9899-1999)

The delay in ANSI approval as an American National Standard did not in
any way change the date. ANSI C99 is "ANSI C99", not "ANSI C00" or
"ANSI C2000". In fact, ANSI doesn't even call it an "ANSI" standard
anymore.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      12-08-2005
Jack Klein said:

> On Wed, 7 Dec 2005 15:48:53 +0000 (UTC), Richard Heathfield
> <(E-Mail Removed)> wrote in comp.lang.c:
>
>> Most people use C89 when they mean either C89 or C90, and C99 when they
>> mean either C99 or C00/C2000 - despite the fact that C89 refers to the
>> ANSI Standard and C99 refers to the ISO Standard.

>
> Sheesh, you are not only beating a dead horse,


It's what we do here.

> you are beating it incorrectly.


That's more serious. Since you know far more about this than I do, I'm happy
to accept the correction and apologise for supplying misinformation.

Just out of curiosity, what's the right way to beat a dead horse?

--
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)
 
Reply With Quote
 
Wolfgang Riedel
Guest
Posts: n/a
 
      12-08-2005
Richard Heathfield wrote:
>

<snip>
> I wasn't aware that executable code was allowed outside a function in C99.
> C&V?
>


not the standart, but the C99 Rationale:

<quote>
5.1.2 Execution Environments

The definition of program startup in the Standard is designed to permit
initialization of static
storage by executable code, as well as by data translated into the program image.
</quote>

so this should be valid (and compiles with -Wall -pedantic -std=c99):

#include <string.h>

size_t blah = strlen("abc");

/*...*/
 
Reply With Quote
 
Simon Biber
Guest
Posts: n/a
 
      12-08-2005
Wolfgang Riedel wrote:
> so this should be valid (and compiles with -Wall -pedantic -std=c99):
>
> #include <string.h>
>
> size_t blah = strlen("abc");
>
> /*...*/


It's not valid, and gcc produces the diagnostic message "initializer
element is not constant" when compiled with exactly the options you give.

--
Simon.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reason for ISO ; warning pemo C Programming 0 12-07-2005 02:58 PM



Advertisments