[cfe-commits] [Review] CharUnits for ASTContext::getTypeSizeInBytes()
John McCall
rjmccall at apple.com
Mon Dec 14 18:55:07 PST 2009
On Dec 14, 2009, at 12:55 PM, Ken Dyck wrote:
> As discussed earlier [1] (apologies for the delay), the attached patch
> introduces CharUnits, an opaque value class for quantities with
> character units.
>
> It uses an int64_t to represent the quantity, has a named constructor, a
> single explicit conversion to a int64_t, and basic arithmetic,
> comparison, and relational operators. It is intended as a return type
> for ASTContext::getTypeSizeInBytes() and other methods that return
> sizes, offsets and alignments in character units.
>
> Comments welcome.
Looks great, thanks! It'd be nice if you could completely eliminate the abstraction overhead, which should be straightforward: just (1) use CharUnits() instead of Zero and (2) define that lonesome operator* in the header (with 'inline' to satisfy the linker).
John.
More information about the cfe-commits
mailing list