In my C++ program, I need to pull a 64 bit float from an external byte sequence. Is there some way to ensure, at compile-time, that doubles are 64 bits? Is there some other type I should use to store the data instead?
Edit: If you're reading this and actually looking for a way to ensure storage in the IEEE 754 format, have a look at Adam Rosenfield's answer below.
An improvement on the other answers (which assume a char is 8-bits, the standard does not guarantee this..). Would be like this:
char a[sizeof(double) * CHAR_BIT == 64];
or
BOOST_STATIC_ASSERT(sizeof(double) * CHAR_BIT == 64);
You can find CHAR_BIT defined in <limits.h>
or <climits>
.