Subj : Re: Any help on why? To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Wed Jul 07 2004 01:58 pm Wayne A. King wrote: >On Wed, 07 Jul 2004 11:15:17 -0700, Bob Gonder wrote: > >>The %LX seems to correct endianness. > >The L is intended for use with e E f F G and is interpreted as a >long double (80 bits). X is intended for use with integer types only. My docs (BCB) show LX as uint64. So don't know about "intended". Also firmly disagree on "integer types only". You can use %X on ANYTHING that goes on the stack, and has the matching size for the prefix to X. I can't see Any way for that to mess up. (Other than the implimentation not supporting LX as TC3/BC3 don't) The OP is using BC5.02, so maybe it does better. >You seem determined to persist in approaching the problem >like an assembler programmer: Exploit low level, platform and >implementation-specific features, bit-fiddling, etc. Then they shouldn't have placed 'cast' and 'union' in the language. They encourage bit-fiddling. Which is what C started out as. It's dificult to write operating systems in C without bit fiddling. Besides, when I (and the OP in this case) use %X, it is almost always in a debug type situation, when platform or compiler differences are moot. Results are what count in those cases, and wasting time making pretty (truly byte-fiddling) expansive code just to see what's going on in there, especially when that code is probably going to be deleted after the bug is caught..... For production code, I use byte-fiddling routines (my asm heritage makes me prefer not to use the printf family, and since I don't use floats, it's no big loss to convert for myself). But printf works fine for quick-and-dirty, where I don't care overly about the output quality or the speed. >IMHO, the proper approach is as a disciplined, informed C/C++ >programmer attempting to use the language as designed so >that the program works consistently and portably. Depends I guess, on if you want to use it "as designed" in the 60/70's or "as designed" in the 90's. I still don't think of C as "designed" in that manner. Though C++ certainly has gone (too far) down that path. .