Y
Yuri Victorovich
In short my question is:
If I overload "operator new" for class A and return from it
instance of struct B (unrelated with A) as allocated memory
area for A should aliasing rules work and allow optimizer
to "merge" assemblies together ?
My opinion: NO, since aliasing rules talk about one lvalue
for access to two unrelated objects and one of these objects
is not constructed yet w/in operator new.
In fact GCC-3.3 applies aliasing rule in this case and code
breaks as the result.
If your answer is YES (aliasing rule applies) doesn't this
undermine meaning of overloading of "operator new" since
it's not much that you can do w/in it then ?
Sincerely,
Yuri
If I overload "operator new" for class A and return from it
instance of struct B (unrelated with A) as allocated memory
area for A should aliasing rules work and allow optimizer
to "merge" assemblies together ?
My opinion: NO, since aliasing rules talk about one lvalue
for access to two unrelated objects and one of these objects
is not constructed yet w/in operator new.
In fact GCC-3.3 applies aliasing rule in this case and code
breaks as the result.
If your answer is YES (aliasing rule applies) doesn't this
undermine meaning of overloading of "operator new" since
it's not much that you can do w/in it then ?
Sincerely,
Yuri