Bug 15114

Summary: Provide compile-time assertions for sizeof(UChar), sizeof(DeprecatedChar), etc.
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Web Template FrameworkAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch ddkilzer: review+

David Kilzer (:ddkilzer)
Reported 2007-08-29 14:41:07 PDT
* SUMMARY The UChar and DeprecatedChar structs have implicit assumptions that they are two bytes on all platforms. It would be nice if there were compile-time assertions that prevented the project from compiling if these assumptions are ever violated. * NOTES A Google search yielded some solutions: Compile Time Assertions in C (CVu 11.3) http://www.jaggersoft.com/pubs/CVu11_3.html Compile-Time Assertions & Debugging http://www.ddj.com/development-tools/184402051 Compile-Time Assertions http://www.ddj.com/architect/184401873
Attachments
patch (1.15 KB, patch)
2009-01-04 09:47 PST, Darin Adler
ddkilzer: review+
Geoffrey Garen
Comment 1 2007-08-29 15:56:01 PDT
If this is possible, it would be really helpful to check sizeof all JSObject subclasses at compile time. The collector assumes a maximum size, but it's not checked at compile time.
Darin Adler
Comment 2 2008-02-24 23:03:30 PST
wtf/Assertions.h has COMPILE_ASSERT, so we just need to use it.
Darin Adler
Comment 3 2009-01-04 09:47:20 PST
David Kilzer (:ddkilzer)
Comment 4 2009-01-04 09:55:28 PST
Comment on attachment 26413 [details] patch r=me
Darin Adler
Comment 5 2009-01-04 10:13:17 PST
Note You need to log in before you can comment on or make changes to this bug.