[Webkit-unassigned] [Bug 43963] Avoid increasing required alignment of target type warning

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 16 02:44:52 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=43963





--- Comment #4 from Gabor Loki <loki at webkit.org>  2010-08-16 02:44:51 PST ---
(In reply to comment #3)
> config.h or Platform.h? 

I see no space for reinterpret_cast_ptr in Platform.h. The platform-, architecture- and compiler-specific features and/or restrictions are in there. The config.h should be about the platform- or feature-specific includes (unfortunately there are other stuff in there). Well, Gavin and I thought the StdLibExtras would be the best place for this reinterpret_cast_ptr, but any suggestions are welcome.

> I think it will be very hard to teach every contributor about where should they use reinterpret_cast_ptr instead of reinterpret_cast.

Well, all contributor should learn not to allocate a char array if the object is used as an int array. ;) Basically most of the reinterpret_casts are used in a correct way. There are only several places where they cannot pass the alignment warning barrier. Although the compiler says warnings on those, those cases also allocate the objects with a good alignment.

Btw, after the ARM buildbots compile with -Werror the developers will be insulted with this alignment warning/error if they do not use the reinterpret_cast in a correct way. ;)

> As I understood reinterpret_cast_ptr is more safe anyway.

Safe? in debug mode on ARM? If so, you are right.
Well, the reinterpret_cast_ptr cannot be used in every situation. It is only useful if the source and the target type is a pointer and the size of target base type is differ from the source one (for example in a case where a reinterpret_cast<int*>(char*) structure is used).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list