Language features and reinterpret casts

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Nov 1 06:42:28 PDT 2010


On 21/09/2010 09:23, Simen kjaeraas wrote:
> bearophile <bearophileHUGS at lycos.com> wrote:
>
>> klickverbot:
>>> Are there any cases where (*cast(int*)&someFloat) does not fit the bill?
>>
>> I am not a C lawyer, but I think that too is undefined in C (and maybe
>> D too).
>
> From your own link
> (http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=109033):
>
>
> "I don't see any way to make conversions between pointers and ints
> implementation defined, and make dereferencing a pointer coming from
> some int anything but undefined behavior."
>

That's not the same thing. Walter was referring to casting an int to a 
pointer, but the above is casting a _float pointer_ to an _int pointer_.

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list