gcc4

Discussion in 'C Programming' started by Servé Laurijssen, May 8, 2005.

  1. I saw that GCC4 is out, anybody knows how well C99 is implemented or where
    to find the info?
     
    Servé Laurijssen, May 8, 2005
    #1
    1. Advertising

  2. Have a look at: http://gcc.gnu.org/gcc-4.0/c99status.html

    "Servé Laurijssen" <> wrote in message
    news:...
    > I saw that GCC4 is out, anybody knows how well C99 is implemented or where
    > to find the info?
    >
    >
     
    André Brière, May 8, 2005
    #2
    1. Advertising

  3. August Karlstrom, May 8, 2005
    #3
  4. Servé Laurijssen

    Nils Weller Guest

    In article <3Mpfe.136840$>, August Karlstrom wrote:
    > Servé Laurijssen wrote:
    >> I saw that GCC4 is out, anybody knows how well C99 is implemented or where
    >> to find the info?
    >>
    >>

    > http://gcc.gnu.org/gcc-4.0/c99status.html


    Another page worth reading is

    http://gcc.gnu.org/gcc-4.0/changes.html

    The Caveats sections of gcc's changes pages are always particularly
    interesting from a portability standpoint because they tell you about
    the deprecation and removal of nonstandard gcc features. The 4.0 series,
    for example, removes support for the -fwritable-strings option (which
    permits a program to modify string constants, causing undefined behavior
    according to ISO C), so there may be much broken legacy code out there
    that will have to be fixed for 4.x.

    --
    Nils R. Weller, Bremen / Germany
    My real email address is ``nils<at>gnulinux<dot>nl''
    .... but I'm not speaking for the Software Libre Foundation!
     
    Nils Weller, May 8, 2005
    #4
  5. Servé Laurijssen

    Richard Bos Guest

    Nils Weller <> wrote:

    > the deprecation and removal of nonstandard gcc features. The 4.0 series,
    > for example, removes support for the -fwritable-strings option (which
    > permits a program to modify string constants, causing undefined behavior
    > according to ISO C), so there may be much broken legacy code out there
    > that will have to be fixed for 4.x.


    Good. Code which relies on this option is broken in the first place, so
    forcing its repair is a beneficial effect.

    Richard, mildly surprised at this new clue shown by gcc
     
    Richard Bos, May 9, 2005
    #5
  6. Servé Laurijssen

    Nils Weller Guest

    In article <4all.nl>, Richard Bos wrote:
    > Nils Weller <> wrote:
    >
    >> the deprecation and removal of nonstandard gcc features. The 4.0 series,
    >> for example, removes support for the -fwritable-strings option (which
    >> permits a program to modify string constants, causing undefined behavior
    >> according to ISO C), so there may be much broken legacy code out there
    >> that will have to be fixed for 4.x.

    >
    > Good. Code which relies on this option is broken in the first place, so
    > forcing its repair is a beneficial effect.
    >
    > Richard, mildly surprised at this new clue shown by gcc


    Obviously, I agree with the essence of your statement, but I don't agree
    with the implied criticism of the gcc team for introducing this option
    in the first place ...

    gcc is a large project that addresses the needs of a wide variety of
    users. Some of these users still have to deal with pre-ANSI C code
    today, whereas many others had to deal with it at one time or another,
    particularly in the first couple of years after the adoption of ANSI C
    (remember that gcc was already around before C89 was even finished.) As
    you may know, K&R C did not forbid you to modify string constants. A
    classical example of a place where some people chose to use a string
    constant in place of a modifyable character array is the Unix function
    mktemp(), which modifies its string argument.

    ANSI C says that attempting to modify a string constant invokes
    ``undefined behavior''; An unfortunate side effect of this fact is that
    any code which does this, while illegal, may happen to work just as
    expected - with K&R C semantics! Therefore, some ANSI compilers (Borland
    comes to mind) still choose to make string constants writable by
    default, so that even new code may be broken in this way *by accident*.

    The -fwritable-strings option (which is implied by gcc's -traditional
    option, by the way) does not exist so that you can write code that
    modifies string constants; It exists so that you can more easily port
    (presumably pre-ANSI) code that relies on this ability. Thus, it does a
    service to those who need to get the job done as quickly and as easily
    as possible, and there are many potential cases where this feature works
    just fine and the problem is never encountered again. And it's just one
    of many system software inventions that exist solely to provide
    compatibility with legacy and/or nonportable code. Other examples are
    the ability to dereference null pointers and misaligned load/store
    instruction emulation for architectures that do not naturally support
    this.

    In any case, it's important to keep in mind that gcc's user community
    does not only consist of people who care about code correctness, and not
    everyone will always agree that it's better to fix the code than to use
    a compiler option like this one. Perhaps you will only have to use the
    code once and can throw it away afterwards. Compatibility features to
    run nonportable code tend to address the needs of an ``end user''; An
    end user of a program does not care about code quality and correctness,
    he may not be capable of debugging the code, and it just has to work no
    matter how. If you *abuse* a compatibility feature as a means to write
    buggy, yet working code, then it's not the fault of the implementor.

    --
    Nils R. Weller, Bremen / Germany
    My real email address is ``nils<at>gnulinux<dot>nl''
    .... but I'm not speaking for the Software Libre Foundation!
     
    Nils Weller, May 9, 2005
    #6
  7. Servé Laurijssen

    BGreene Guest

    not pertinent
    "Servé Laurijssen" <> wrote in message
    news:...
    > I saw that GCC4 is out, anybody knows how well C99 is implemented or where
    > to find the info?
    >
    >
     
    BGreene, Jul 6, 2005
    #7
  8. BGreene <> wrote:
    > not pertinent
    > "Serv? Laurijssen" <> wrote in message
    > news:...
    > > I saw that GCC4 is out, anybody knows how well C99 is implemented or where
    > > to find the info?
    > >
    > >


    About as well as GCC3.4, or GCC3.3.

    http://gcc.gnu.org/c99status.html
     
    William Ahern, Jul 6, 2005
    #8
    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. Marcel van Kervinck

    Bug in gcc4 initialisers suspected

    Marcel van Kervinck, May 17, 2005, in forum: C Programming
    Replies:
    34
    Views:
    928
  2. C++0x and GCC4.3

    , Mar 12, 2008, in forum: C++
    Replies:
    2
    Views:
    389
    Jerry Coffin
    Mar 21, 2008
  3. nirinA raseliarison
    Replies:
    0
    Views:
    402
    nirinA raseliarison
    May 17, 2011
  4. Replies:
    3
    Views:
    142
  5. Replies:
    12
    Views:
    198
Loading...

Share This Page