something about gcc3.4.2

Discussion in 'C Programming' started by usr.root@gmail.com, Dec 21, 2005.

  1. Guest

    i have done a test like this with gcc3.4.2:
    int main(){

    for(int i =0;i<3;i++);

    return 0;
    }
    if i complile my code without using -std=c99,it shows a message :'for'
    loop initial declaration used outside C99 mode .
    i wonder that if not use -std=c99,which std it compile with?how can i
    find that out?
    (if i use -std=c99,it's ok)
    , Dec 21, 2005
    #1
    1. Advertising

  2. "" <> writes:
    > i wonder that if not use -std=c99, which std it compile with? how
    > can i find that out?


    GNU C, which can be more or less accurately described as C89 with
    extensions.

    The problem with declarations in the initialization part of a for loop
    is that GCC had a similar feature with slightly different semantics
    before it was standardized. Code that relies on those semantics will
    either not compile or produce different results with -std=c99, so the
    GCC maintainers have decided to deprecate the old extension.

    DES
    --
    Dag-Erling Smørgrav -
    =?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=, Dec 21, 2005
    #2
    1. Advertising

  3. Skarmander Guest

    Skarmander, Dec 21, 2005
    #3
  4. "" <> writes:
    > i have done a test like this with gcc3.4.2:
    > int main(){
    >
    > for(int i =0;i<3;i++);
    >
    > return 0;
    > }
    > if i complile my code without using -std=c99,it shows a message :'for'
    > loop initial declaration used outside C99 mode .
    > i wonder that if not use -std=c99,which std it compile with?how can i
    > find that out?
    > (if i use -std=c99,it's ok)


    That's a question about gcc, not about the C language. You'll find
    the answer in the extensive documentation that's provided with gcc.

    --
    Keith Thompson (The_Other_Keith) <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.
    Keith Thompson, Dec 21, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Ying
    Replies:
    2
    Views:
    589
    James Ying
    Oct 28, 2003
  2. Philip Goisman
    Replies:
    5
    Views:
    486
    Jonathan Turkanis
    Jan 22, 2004
  3. John Black
    Replies:
    1
    Views:
    342
    Karthiik Kumar
    Aug 28, 2004
  4. Bart Blommerde

    using hash_set in gcc3.3

    Bart Blommerde, Oct 13, 2004, in forum: C++
    Replies:
    5
    Views:
    518
    John Harrison
    Oct 13, 2004
  5. Replies:
    2
    Views:
    363
    red floyd
    May 18, 2005
Loading...

Share This Page