[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: AC_PROG_CC_C99 and -std=c99

From: 'Chris Hall'
Subject: RE: AC_PROG_CC_C99 and -std=c99
Date: Mon, 18 Jun 2012 16:22:25 +0100

Bob Friesenhahn wrote (on Sun 17-Jun-2012 at 20:13 +0100):
> On Sun, 17 Jun 2012, 'Chris Hall' wrote:
> > So, my first question is: am I mistaken in thinking that using
> > -std=c99 will help, portability-wise ?
> It is often expected that requesting a specific standard at
> compile-time will aid with portability.  Usually the results are the
> opposite of that because the standard requires that interfaces not
> specified by the standard are not exposed and are therefore not
> usable.  Likewise, if a system does not support the standard, the
> result is usually utter failure.  It is typical that there are
> multiple conflicting standards supported by the OS and requesting
> one breaks use of the other.

I'm sorry, but I don't understand: if some interface is not supported
by the standard, I don't want it... because if I use something outside
the standard I cannot reasonably expect some other c99 compiler to
support it.  Surely ?

I try to be reasonably conservative and I wouldn't have much sympathy
with a compiler that doesn't cover the c99 things I do use.

Since I spend most of the time using gcc, I want to avoid
inadvertently using gnu99 extensions.  So, what I currently do is
avoid AC_PROG_CC_C99 for the compilers I know about, and for gcc, in
particular, set -std=c99 "by hand".

Breaking some other compiler by using gcc specific extensions seems to
me to be a greater risk than using some part of c99 which is not
supported by that compiler.  Or, at least, if I break things by
issuing code which is not Standard c99 that's my fault, where finding
that some compiler is not very good at c99 is not !

If I have to take steps to cope with some compiler that doesn't
support c99 well enough, then I so be it.  It seems to me that taking
steps to "escape" Standard <whatever>, if required, is preferable to
having to take steps to "force" Standard <whatever>.

On the other hand, if gnu99 is in practice a more widely followed
standard than ISO C99, then I can stop worrying and let AC_PROG_CC_C99
select gnu99 for me.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]