My guess was that the proper way to do this was: Let me make sure I got this straight. But I can’t seem to find any other way to do the same thing in a standard approved way. In C, I’d like to use printf to display pointers, and so that they line up properly, I’d like to pad them with 0s. The reason what I tried to do is not portable is because not all platforms display pointers as 0x Fixed in the answer.

Uploader: Arakazahn
Date Added: 19 February 2011
File Size: 63.37 Mb
Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X
Downloads: 80913
Price: Free* [*Free Regsitration Required]

Rodrigo Queiro 5 As your link suggests already, the behaviour is undefined. If so, is there a standard ms 6585 motherboard, portable way of doing this?

So here is the double question: My guess was that the proper way to do this was: Should be removed from gcc IMHO. motherboarr

If standard, which standard? This is way better than using the p conversion because the latter is implementation-defined. Is this standard, or gcc specific?

Email Sign Up or sign in with Google. Note my comment about Windows bit; this will not work there. What’s the proper use of printf to display pointers ms 6585 motherboard with 0s Ask Question. If you choose to use a compiler that doesn’t conform to C99, like MSVCit’s up to you to find out how to ms 6585 motherboard it, probably with an ifdef. You could of course just cast the pointer to an int and display it in hex: Is my understanding correct that this behavior is not defined by the C99 standard?

If this is a problem on your platform use a long long. Post as a guest Name. Note the usage of the asterisk character to fetch the ms 6585 motherboard by the next argument, which is in C99 probably before?

Reading it, it seems that the reason why gcc complains is that the syntax I suggested is not defined in C You could of course just cast the pointer to an int and display it in hex:.

I think BTW that is the letter ‘l’ not 1 the number before the ‘x’.

Check whether earlier versions supported ll before using it. Sign up using Facebook.


Maybe this will be interesting from a bit ms 6585 motherboard machine, using mingw: What I wrote gets me what I like and not what I dislike. Stack Overflow works best with JavaScript enabled. Shouldn’t have be DEAD: I suppose that isn’t portable to bit systems, but it works fine for bitters. Jul 23 ’10 at Actually, I think pointers a ms 6585 motherboard to fit inside a long.


I’ll be interested in seeing what answers there are for portable solutionssince pointer representation isn’t exactly portable. By posting your motherbiard, you agree to the privacy policy and terms of service. The problem is this won’t work on all platforms as it assumes a pointer can fit inside a long, and that a pointer can be displayed in 16 characters 64 bits.

Yup – motherboad for the ms 6585 motherboard. The problem I ms 6585 motherboard with this suggestion: Jonathan Leffler k 82 The cast to unsigned long before recasting to unsigned long long breaks if sizeof unsigned long! Sign up using Email and Password.

Jerry Miller 4 The only implementation that doesn’t conform to this is MSVC bit. But what is BEAF? In C, I’d like to use printf to display pointers, and so that they line up properly, I’d motheerboard to pad them with 0s. Ms 6585 motherboard is however true on most platforms. That’s not a bug, just an unexpected feature. This is admittedly inconvenient though of course you can wrap ms 6585 motherboard in a function. Because of ms 6585 motherboard padding with 0s is not portable. I think the both the bit and bit version warn about it.

Fixed in the answer. AnthonyLambert 6, 3 28 Also note that some implementations of printf print a ‘ 0x ‘ in front of the pointer; others do not and both are correct according to the C standard. Note that on Windows bit, the type unsigned long is still a bit 6558, though pointers are bits. Keith Thompson k 24


This article was written by Mary