In regard to "BYTEmark Bug Bashed" (December), it appears to me that the bug is with the compiler vendor's
malloc()
rather than with your code. The C Standard section on memory management functions states that "the pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to a pointer to any type of object and then used to access such an object or an array of such objects in the space allocated (until the space is explicitly freed or reallocated)." If double requires 8-byte alignment to work properly, and double has the strictest alignment requirements, then
malloc()
should return memory aligned to at least 8-byte boundaries.
BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin,
and dozens of other CMP publications—bringing
you critical news and information about wireless communication,
computer security, software development, embedded systems,
and more!