FFTW : how to prevent breaking aliasing rules?
问题 I have a code which uses the std::complex<double> type. From FFTW Manual : if you have a variable complex<double> *x , you can pass it directly to FFTW via reinterpret_cast<fftw_complex*>(x) . However, when I do this in my code : tmp_spectrum = reinterpret_cast<std::complex<double>*>(fftw_alloc_complex(conf.spectrumSize())); plan_bw_temp = fftw_plan_dft_c2r_1d(conf.FFTSize(), reinterpret_cast<fftw_complex*>(tmp_spectrum), tmp_out, FFTW_ESTIMATE); I get dereferencing type-punned pointer might