You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using fftw3 in a C++ application requires thunking layers because the array data type R C[2] is not compatible to std::complex at language level. They are guaranteed to be binary compatible, but C++ does not even allow casts between arrays and classes.
So pointer conversions are required at several places. This makes the code poorly readable, error prone and may even prevent some compiler optimizations due to the required reinterpret casts.
It should be possible to force fftw3.h to use std::complex similar to the support for C99 _Complex.
The text was updated successfully, but these errors were encountered:
Since FFTW is a pure C library, APIs should be wrapped by extern "C" {}. With the addition of std::complex, there should be an implementation of the whole complex interface to do the reinterpret casts... like the f77 interface did.
Hmm, yes the injection of C++ code in the header is not that pretty. A separate include for this purpose might be a better solution than a macro like FFTW_cpp_complex.
However, there is no need to wrap any function. Replacing the definition of FFTW_DEFINE_COMPLEX is sufficient.
Using fftw3 in a C++ application requires thunking layers because the array data type
R C[2]
is not compatible tostd::complex
at language level. They are guaranteed to be binary compatible, but C++ does not even allow casts between arrays and classes.So pointer conversions are required at several places. This makes the code poorly readable, error prone and may even prevent some compiler optimizations due to the required reinterpret casts.
It should be possible to force fftw3.h to use std::complex similar to the support for C99
_Complex
.The text was updated successfully, but these errors were encountered: