[Carpet] hdf5toascii_slicer: integer constant overflows (prevents compiling)
Jonathan Thornburg
jthorn at aei.mpg.de
Mon Aug 21 08:35:07 CEST 2006
I wrote:
| The fix is easy: just change the literal to floating-point (since that's
| how it's used anyway):
| #define SLICECOORD_UNSET -424242424242.0 // this is about 2**39 in
| // magnitude, small enough
| to
| // be exactly represented
| in
| // IEEE 'double' floating
| point
| // (this is important
| because
| // later code tests if
| values
| // are == or != this
| #define)
| static double slice_coord[3] = {SLICECOORD_UNSET, SLICECOORD_UNSET,
| SLICECOORD_UNSET};
On Sun, 20 Aug 2006, Erik Schnetter wrote:
> Just to nitpick: What about
>
> static double const slicecoord_unset = -424242.0
>
> instead? It's more C++y, it's type-safe since it uses a constant instead of a
> macro, and it can even be converted into an integer without overflow.
I agree, that's better. Who's pushing a patch for this one: Erik, Thomas,
or me?
ciao,
--
-- Jonathan Thornburg <jthorn at aei.mpg.de>
Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
More information about the developers
mailing list