Re: printf("%d",float)
- From: Philip Potter <pgp@xxxxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 08:30:41 +0000
Richard Heathfield wrote:
Jack Klein said:
On Wed, 31 Oct 2007 01:15:33 +0000, Richard Heathfield<snip>
<rjh@xxxxxxxxxxxxxxx> wrote in comp.lang.c:
You are wrong in thinking that %d is the appropriate format specifierYou were right in the first pronouncement, not necessarily so in the
for a float, and you are wrong in thinking that you can meaningfully
cast the address of a float into the address of an int.
second. The result of casting a pointer to an object or incomplete to
a pointer to any other object or incomplete type, is undefined if the
pointer is not suitably aligned for the second type, but well defined
if there is no alignment error. Of course, dereferencing that pointer
is completely undefined.
Right, which is why I consider the conversion meaningless.
So conversion to void * is always meaningless, because no void * can be dereferenced?
Phil
--
Philip Potter pgp <at> doc.ic.ac.uk
.
- Follow-Ups:
- Re: printf("%d",float)
- From: Richard Heathfield
- Re: printf("%d",float)
- References:
- printf("%d",float)
- From: candy_init
- Re: printf("%d",float)
- From: Richard Heathfield
- Re: printf("%d",float)
- From: Jack Klein
- Re: printf("%d",float)
- From: Richard Heathfield
- printf("%d",float)
- Prev by Date: Re: which one requires less memory?
- Next by Date: Re: printf("%d",float)
- Previous by thread: Re: printf("%d",float)
- Next by thread: Re: printf("%d",float)
- Index(es):
Relevant Pages
|