This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __gnu_cxx error in OpenSolaris


On 19 May 2011 09:43, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 19/05/2011, Dr. David Kirkby wrote:
>> On 05/18/11 10:09 PM, Dennis Clarke wrote:
>>> Stick with GCC and you will be happy.
>>
>> That's if you want to write in GNU C++ and don't care about writing standard
>> C++
>> code.
>
> (While we're making gross generalisations...) Every compiler with a
> significant user base creates ghettos of non-portable code.


But the default behavior of GCC is to permit loads of GNU extensions.
Therefor lots of people who write code are writing in some variant of
the C language - usually without realising it.

I've spent a lot of time working on the Sage maths project, which
contains over 90 bits of open-source software. I've noticed that those
bits of code which will not compile with the Sun compiler tend to
present more problems when built with gcc than code that will compile
cleanly with the Sun compiler.

There's one bit of code in particular

http://boxen.math.washington.edu/home/kirkby/bad-code/sympow-1.018.1.p7/src/

~(do a wget -r if you want it)

which is of appalling quality, yet gcc will compile it. When I tried
finding a problem in that code, it was difficult as the code was not
valid C, so I had no idea what the author actually intended.

12 years after the C99 standard was introduced gcc still does not
fully support it. But numerous extensions have been developed in that
time.

> I'm curious what you consider to be "GNU C++" because there are fewer
> and fewer non-standard constructs accepted, and the trend is generally
> to remove support for them not encourage them.

I can't see how you can say that. See:

http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options
-sts=`gnu89'
    GNU dialect of ISO C90 (including some C99 features). This is the
default for C code.

It's bad this is the default, but when (IF?) C99 ever gets fully
supported we find the default will again be to permit GNU extensions.

gnu9x'
    GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
this will become the default. The name `gnu9x' is deprecated.

>> GCC is useful, but it is the cause of a lot of badly written code.
>
> That can be said about nearly any compiler that's used to write a lot
> of code, and I'm sure you know what they say about bad workmen and
> their tools.


True, but the tools could be a bit more protective. If you are a pilot
and you want to crash a plane you can do. But the computer systems
will protect against stalls and other avoidable conditions.

There's no such warnings when you do non-standard things with gcc.
Sure there are obscure options which aim to accept only standard
conforming C, but I argue these should not be options but be defaults.

Dave


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]