[Developers] C99

Tom Goodale goodale at cct.lsu.edu
Tue Sep 26 07:24:27 CDT 2006

On Fri, 22 Sep 2006, Erik Schnetter wrote:

> On Sep 22, 2006, at 09:59:51, Tom Goodale wrote:
>> On Fri, 22 Sep 2006, Erik Schnetter wrote:
>>> On Sep 22, 2006, at 06:49:54, Frank Loeffler wrote:
>>>> Hi,
>>>>> On 21.09.06, Frank Loeffler wrote:
>>>>>> Is there a way of telling Cactus to use the C99 standard? Or even 
>>>>>> better
>>>>>> - could we by default enable it, if it is available for a compiler?
>>>> Steve White wrote:
>>>>> If the compile fails, you tell the user
>>>>> what to do about it.
>>>> That was exacly my point - what should the user do about it?
>>>> He could dig through the documentation of his compiler and change his
>>>> compiler options by hand.
>>>> However, it would be nicer to have something like a configuration option
>>>> 'C99="yes"' for Cactus to use C99, maybe even turned on by default. Then
>>>> a thorn can check for that and give a suitable error message like
>>>> 'Please set C99 to "yes" in your configuration to use this thorn.'
>>> This sounds overly complicated.  Cactus knows, for each compiler on each
>>> architecture, a set of default flags that it uses.  You can add the C99 
>>> flags
>>> to these.  (Of course, you need to make sure things don't break etc.)
>>> The largest problem is finding out these flags for each compiler.  For
>>> example, gcc has a "std=c99" flag, but you don't want to use that; 
>>> instead,
>>> you want to use "std=gnu99".
>>> The scripts handling this are in lib/make/known-architectures.  Have a 
>>> look,
>>> add the C99 flags for your favourite compilers, and submit a patch.
>>> I'm all for this change.
>> I think the C99=yes may be better, as we can't guarantee C99 everywhere so
>> it would be good if it was a conscious decision to use C99 features.
> We could have CC and C99, as we have F77 and F90...

That would probably excessive, and we'd also then need to introduce a 
different file suffix to distinguish non-C99 C from C99 C !  So perhaps 
the flag should be ENABLE_C99=yes which would enable the C99 features in 
compilers where we know them.  We could also in principle add autocong 
macros which detect C99 features (when enabled) and produce workarounds or 
#defines to be checked against by code which requires a 
not-always-implemented feature.



More information about the Developers mailing list