[Carpet] carpet experimental on belladonna

Erik Schnetter schnetter at cct.lsu.edu
Tue Jun 12 18:05:24 CEST 2007


On Jun 12, 2007, at 11:29:51, Nils Dorband wrote:

> Hi,
>
> I am having trouble, compiling carpet-experimental on belladonna.
> Below is the error output and my configuration on belladonna. I don't
> have problems on different machines. It seems to me, that the PG
> compiler does not like something about the definition of
> "static_assert".

[schnipp]

> "/home/dorband/Cactustmp/Cactus/configs/bssn/build/CarpetLib/
> gdata.cc", line 277: error:
>            function call is not allowed in a constant expression
>          static_assert (abs(0.1) > 0,
>          ^
>
> 1 error detected in the compilation of "/home/dorband/Cactustmp/
> Cactus/configs/bssn/build/CarpetLib/gdata.cc".

The static_assert is an assertion that is supposed to be evaluated at  
compile time, so that errors are caught earlier.  In this case, the  
compiler doesn't seem to know how to handle the abs function at  
compile time.  All other compilers do, but I don't know what the C++  
standard says in this respect.  It could also be that the compiler  
doesn't find the correct definition for the abs function -- there are  
several, at least one for integers in <math.h>, and a generic one in  
<cmath> in the namespace std.

As a work-around, you can replace the line by

	assert (abs(0.1) > 0);

omitting the second argument of static_assert.  This assertion checks  
whether the compiler can handle real arguments to the abs function,  
because (if there is an error) the compiler may instead only accept  
integer arguments, then automatically round to integer, and this will  
then lead to very wrong results.

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/developers/attachments/20070612/e0f04610/attachment.pgp 


More information about the developers mailing list