Subj : Re: Any help on why? To : borland.public.cpp.borlandcpp From : maeder Date : Wed Jul 07 2004 08:01 pm Bob Gonder writes: > Thomas Maeder [TeamB] wrote: > >>Bob Gonder writes: >> >>> Poster could have used %lX for float or double as %X is int, whatever >>> size that is (target dependant).. >> >>Certainly not. > > Certainly not what? dependant? Ok, but I thought in the olden days > floats were 4 bytes, doubles, double that (hence the distinction). X and lX are for integral values. Using them for something else is an even uglier hack than using the *printf() machinery at all. To peek at the internals of, say, a double, the portable way is to treat it as an array of unsigned char, as in double d(3.11415); unsigned char const *const begin(reinterpret_cast(&d)); unsigned char const *const end(begin + sizeof d); for (unsigned char const *c = begin; c!=end; ++c) printf("%u ",static_cast(*c)); The result of this snippet is not portable, but the approach looks very portable to me. .