Add strict_aliasing_cast<T>() to avoid need for custom unions We could do things like: http://trac.webkit.org/projects/webkit/changeset/28455 Using a template function, which I think might lead to more readable code: template<type T, type S> strict_aliasing_cast<T>(S original) { union TmpUnion { S original; T casted; }; TmpUnion u; u.original = original; return u.casted; } then that change just becomes: return strict_aliasing_cast<TMalloc_Heap*>(&pageheap_memory[0]);
Didn't sam already add something like this? If so, this should be closed.
If I'm not mistaken, this looks to be bitwise_cast in JavaScriptCore/wtf/StdLibExtras.h. So this bug can probably be closed.