// FORWARD FOURIER TRANSFORM, INPLACE VERSION
// Data - both input data and output
// N - length of both input data and result
bool CFFT::Forward(complex *const Data, constunsignedint N)
{
// Check input parameters
if (!Data || N < 1 || N & (N - 1))returnfalse;
Data is an array of real values. N is an integer, typically < 100.
or this statement:
1 2 3 4 5 6
bool CFFT::Forward(const complex *const Input, complex *const Output,
constunsignedint N)
{
// Check input parameters
if (!Input || !Output || N < 1 || N & (N - 1))returnfalse;
I don't understand the meaning of the statement I highlighted, actually, in reality I don't understand only this part:
Thank you very much. I am aware of that (power of 2 requirement) but thought that in principle this condition can be neglected but that will result in a lengthier computations. Mine was 100. You've saved my day. - A.
The "!Data" check is a stupid check because it only tests one type of pointer problem (NULL pointer). It is best to not check this at all. There are many more ways in which Data can be "wrong" and not be 0. If you are calling an FFT function with one of the input or output pointer wrong, you deserve what's coming, not "false".
The "!Data" check is a stupid check because it only tests one type of pointer problem (NULL pointer). It is best to not check this at all.
Please express your opinions on a perfectly reasonable error test as an opinion and not as fact. If the convention is for a NULL pointer to represent an empty in/output set to avoid special treatment of NULL outside the function and/or be consistent with the design of other functions in the library, it would be a crime not to check it.