Bug 16317

Summary: Add strict_aliasing_cast<T>() to avoid need for custom unions
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: mrobinson, mrowe, sam
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
URL: http://trac.webkit.org/projects/webkit/changeset/28455

Eric Seidel (no email)
Reported 2007-12-05 19:08:19 PST
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]);
Attachments
Eric Seidel (no email)
Comment 1 2008-02-25 23:27:54 PST
Didn't sam already add something like this? If so, this should be closed.
Martin Robinson
Comment 2 2009-10-23 15:44:28 PDT
If I'm not mistaken, this looks to be bitwise_cast in JavaScriptCore/wtf/StdLibExtras.h. So this bug can probably be closed.
Note You need to log in before you can comment on or make changes to this bug.