On 2013-01-06 23:39, Ian Collins wrote:
> wrote:
>
> Please wrap your lines!
>
>> First thank you for your answer, but you misunderstood me.
>>
>> I do know that my example will compile with any compiler.
>>
>> I wanted to know, if this mini programm does work exactly the same
>> (with the same outputs), when I compile it with different compilers.
>
> As posted, it won't compile with any compiler.
>
> As I said in my reply (that you forgot to quote), all reinterpret_cast
> does is tell the compiler to interpret a bunch of bits as a particular
> type.
We can assume that everybody knows that.
> If the data pointed to happens to be of a compatible type and
> alignment, it will probably work. If not, it won't.
>
Question should be if there is guarantee that data placement is done in
the same way among different compilers. If not reinterpret_cast is not
portable at all.
Regards
Marek