Results 1 to 6 of 6

Thread: warning: C++ style comments are not allowed in ISO C90

  1. #1
    Join Date
    Jun 2009
    Beans
    49

    warning: C++ style comments are not allowed in ISO C90

    it seems with -pedantic flag part of CFLAGS makes
    gcc spit the following errors:

    warning: C++ style comments are not allowed in ISO C90

    so what types of comments are allowed if i cannot use: // or /* */ style comments?

  2. #2
    Join Date
    Mar 2008
    Beans
    227

    Re: warning: C++ style comments are not allowed in ISO C90

    Huh? These /* */ are valid C comment delimiters.

  3. #3
    Join Date
    Oct 2007
    Location
    $HOME
    Beans
    631

    Re: warning: C++ style comments are not allowed in ISO C90

    C++ style comments not allowed refers to // not the /* */ pair

  4. #4
    Join Date
    Jun 2009
    Beans
    49

    Re: warning: C++ style comments are not allowed in ISO C90

    created small test project ...
    // generates warning
    but
    /* does not */


    very interesting...

    i wonder if -pedantic is worth the effort... seems i only get these warning in my project but nothing useful.

  5. #5
    Join Date
    Apr 2005
    Beans
    849

    Re: warning: C++ style comments are not allowed in ISO C90

    of course its worth the effort to use pedantic
    just use
    -std=c++98 or similar
    Last edited by monkeyking; June 19th, 2009 at 11:47 AM.
    Running 8.10 on a lenovo 3000 n200!
    Fingerprint reader doesn't work.

  6. #6
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: warning: C++ style comments are not allowed in ISO C90

    Let's do some history

    The // comments were created at BCPL, but during the development of its successor B, these were dropped in favor of /* */... and these were inherited by B's successor, C.

    C++ decided to resurrected the BCPL-style comment, along with the C-style ones. Of course, these proved to be very handy for short comments and C compilers began to accept them as a non-standard feature. gcc, when using the default GNU89 "standard", will accept them... The issue is that -pedantic will switch compilation to ISO C90.

    The newest C standard is C99 and accepts the BCPL/C++-style comments. Use -std=c99 and it should work, even with -pedantic.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •