[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 04:55:52 PDT 2010


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





--- Comment #5 from Balazs Kelemen <kb at inf.u-szeged.hu>  2010-08-16 04:55:52 PST ---
(In reply to comment #4)
> (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 was thinking about config.h because we use config.h like a prefix header so the define would be present without extra effort. Platform.h is similar from this viewpoint because it is included in config.h.

> > 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.
>

I see. I thought that it is a more general case.

> 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).

Well, this situation is the only one when a reinterpret_cast should be used. Anyway, if reinterpret_cast_ptr is needed only in special cases I agree that is better to do it explicitly.

-- 
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