This is way better than using the p conversion because the latter is implementation-defined. I think the both the bit and bit version warn about it. What’s the proper use of printf to display pointers padded with 0s Ask Question. Is my understanding correct that this behavior is not defined by the C99 standard? Join Stack Overflow to learn, share knowledge, and build your career.
|Date Added:||13 March 2007|
|File Size:||5.49 Mb|
|Operating Systems:||Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X|
|Price:||Free* [*Free Regsitration Required]|
Fixed in the answer. By posting your answer, you agree to the privacy ms 6585 motherboard and terms of service. Actually, I think pointers a guaranteed to fit inside a long. Sign up using Email and Password.
If standard, which standard? I suppose that isn’t portable to bit systems, motherboarv it works fine for bitters. This answer is similar to the one given earlier in https: Is my understanding correct that this behavior ms 6585 motherboard not defined by the C99 standard? Should be removed from gcc IMHO.
Reading it, it ms 6585 motherboard that the reason why gcc complains is that the syntax I suggested ms 6585 motherboard not defined in C This is way better than using the p conversion because the latter is implementation-defined. Sign up using Facebook. Jerry Miller 4 Also see the comment left by AProgrammer on the accepted answer. BEEF for segmented mode.
Check whether earlier versions supported ll before using it. Let me make sure I got this straight. Yup – thanks for the reminder.
IMPORTACIONES CALLAO: EMBARCADORES
If this is a problem on your platform use a long long. But what is BEAF? Email Sign Up or sign in with Google.
ms 6585 motherboard Rodrigo Queiro 5 That’s not a bug, just an unexpected feature. Note my comment about Windows bit; this will not work there. Also note that some implementations of printf print a ‘ 0x ‘ in front ms 6585 motherboard the moterboard others do not and both are correct according to the C standard.
Post as ms 6585 motherboard guest Name. You could of course just cast the pointer to an int and display it in hex:. Maybe this will be interesting from a bit windows machine, using mingw: Ms 6585 motherboard cast to unsigned long before recasting to unsigned long long breaks if sizeof unsigned long! If you choose to use a compiler that doesn’t conform to C99, like MSVCit’s up to you to find out how to do it, probably mothsrboard an ifdef. As your link suggests already, the behaviour is undefined.
This is admittedly inconvenient though of course you can wrap it in ms 6585 motherboard function. Jonathan Leffler k 82 Join Stack Overflow to learn, share knowledge, and build your career.
The reason what I tried to do is not portable is because not all platforms display pointers as 0x I think the both the bit and bit version warn about it. What’s the proper use of printf to display pointers padded with moyherboard Ask Question. Because of this padding with 0s is not portable. Note that on Windows bit, the type unsigned mtoherboard is still a bit quantity, ms 6585 motherboard pointers are bits.
IMPORTACIONES CALLAO: EMBARCADORES
Joe D – VS disagrees. The problem is this won’t work on all platforms motherboqrd it assumes a pointer can fit inside a long, and that a pointer can be displayed in 16 characters 64 bits. AnthonyLambert 6, 3 28 I think BTW that ms 6585 motherboard the letter ‘l’ not 1 the number before the ‘x’. This is however true ms 6585 motherboard most platforms. But I can’t seem to find any other way m do the same thing in a standard approved way.
Sign up or log in Sign up using Google. If portability to windows is important, relying on C99 features is probably not the thing to do. In C, I’d like to use printf to display pointers, and ms 6585 motherboard that they line up properly, I’d like to pad them with 0s. Note the usage of the asterisk character ms 6585 motherboard fetch the width by the next argument, which is in C99 probably before?
Shouldn’t have be DEAD: I’ve googled a bit for it, and the following thread is ms 6585 motherboard the same topic, but doesn’t really give a solution.
Of course VS isn’t exactly known as a paragon of compliance You could of course just cast the pointer to an int and display it in hex: So, unless I am mistaken, what you suggest would break on ms 6585 motherboard least one major platform.