From 455ad2bf70eb0a6e29c8c7179e1c40c18bd8ee2f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Jul 2015 17:37:23 +0200 Subject: Get rid of accessors/modifiers in cli.cxx target --- build/cli/target | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'build/cli/target') diff --git a/build/cli/target b/build/cli/target index d733668..a32f718 100644 --- a/build/cli/target +++ b/build/cli/target @@ -28,15 +28,23 @@ namespace build public: using mtime_target::mtime_target; - target* m[3] {nullptr, nullptr, nullptr}; - - cxx::hxx* h () const {return static_cast (m[0]);} - cxx::cxx* c () const {return static_cast (m[1]);} - cxx::ixx* i () const {return static_cast (m[2]);} - - void h (cxx::hxx& t) {m[0] = &t;} - void c (cxx::cxx& t) {m[1] = &t;} - void i (cxx::ixx& t) {m[2] = &t;} + union + { + // It is theoretically possible that the compiler will add + // padding between the members of this struct. This would + // mean that the optimal alignment for a pointer is greater + // than its size (and that an array of pointer is sub- + // optimally aligned). We will deal with such a beast of + // an architecture when we see it. + // + struct + { + cxx::hxx* h; + cxx::cxx* c; + cxx::ixx* i; + }; + target* m[3] = {nullptr, nullptr, nullptr}; + }; virtual group_view group_members (action) const; -- cgit v1.1