Ah, thanks for the clarification.
If I can be of any help with the porting, let me know.


From: Joel Sherrill <j...@rtems.org>
Sent: Mittwoch, 11. Januar 2023 14:08
To: Sommer, Jan <jan.som...@dlr.de>
Cc: rtems-us...@rtems.org <users@rtems.org>
Subject: Re: C++ math functions not available in namespace std

This happens on the architectures where size of long double is not the same as 
double. The header file disables everything if any math method is missing.

I have it on my list to address. I was porting the long double methods from 
FreeBSD before anyone ran into this but haven't finished

On Wed, Jan 11, 2023, 3:43 AM <jan.som...@dlr.de<mailto:jan.som...@dlr.de>> 
wrote:
Hello and happy New Year,

I stumbled upon a slightly weird problem with the current cross-compilers.
According to https://en.cppreference.com/w/cpp/numeric/math/fmax std::fmax 
should be part of <cmath> for >= C++11.
However, if I try to use it, I sometimes get  "error: 'fmax' is not a member of 
'std'; did you mean 'max'?"

I do get the error when compiling the test file (see below) with  
i386-rtems6-g++ and riscv-rtems6-g++, but for example not for arm-rtems6-g++.
If I use "fmax" instead of "std::fmax" the file compiles for all 3 
architectures.
However, I have a library which uses the math functions with the namespace 
qualifier, which I cannot change that easily.

Does someone know, what is the reason for that behavior (I guess it's related 
to newlib?) and what a solution could look like?

Best regards,

    Jan


PS: My test file looks like this:

#include <cmath>

double test(double a, double b)
{
    return std::fmax(a, b);
}


_______________________________________________
users mailing list
users@rtems.org<mailto:users@rtems.org>
http://lists.rtems.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to