This kind of optimized placement could in principle be done by a sufficiently smart compiler, but no such compiler exists.  That&#x27;s why existing compilers allow their users to control layout by, as you say, relying on an implementation detail.