octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: potential problem with fftw changes


From: John W. Eaton
Subject: Re: potential problem with fftw changes
Date: Tue, 17 Feb 2004 12:19:48 -0600

On 17-Feb-2004, David Bateman <address@hidden> wrote:

| Given that we can't get the correct data alignment, we do need to check the
| alignment for the plans. So we need the cast to int or long? Is 
| 
|    char in_align = in & 0xF;
|    char out_align = out & 0xF;
| 
| alright? Will it be correct for all platforms?

G++ won't compile that if in and out are pointers to double.  So I
changed it to

  char in_align = (reinterpret_cast<long> (in)) & 0xF;

which I think will work provided that pointers and long are the same
size.

BTW, I'd like to request that anyone writing code for Octave always
use C++-style casts in C++ code.  I think that's important because if
you are using a cast, then it almost always means that you are trying
to be sneaky in some way or do something that might not be portable or
that could fail if your assumptions later turn out to be invalid.
With the C++-style casts, it is easy to find them, which means it is
possible to periodially review all the places where casts have been
used and decide whether there is some better way to write the code and
avoid them.

Thanks,

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]