Hi,
Can someone explain me why the following line of code does not compile
the same way on g++ 3.4.6 and g++ 4.1.1 in 64 bits:
(char*&)p += sizeof(A);
AND
p = reinterpret_cast<A*>(reinterpret_cast<char*>(p) + sizeof(A));
in the following context:
struct A {double c[4];};
A* p = reinterpret_cast<A*>(new char[sizeof(A)*2]);
// LINE
p->c[2] = 12.0;
GCC4/64
With first line
main:
.LFB2:
subq $24, %rsp
.LCFI0:
movl $64, %edi
call _Znam
movabsq $4622945017495814144, %rdx
movq %rdx, 16(%rax)
xorl %eax, %eax
addq $24, %rsp
ret
With second line
main:
.LFB2:
subq $8, %rsp
.LCFI0:
movl $64, %edi
call _Znam
movabsq $4622945017495814144, %rdx
movq %rdx, 48(%rax)
xorl %eax, %eax
addq $8, %rsp
ret
GCC3.4/64
main:
.LFB2:
subq $8, %rsp
.LCFI0:
movl $64, %edi
call _Znam
movabsq $4623507967449235456, %rdx
movq %rdx, 48(%rax)
xorl %eax, %eax
addq $8, %rsp
ret
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus