On Saturday, 7 August 2021 at 13:36:52 UTC, james.p.leblanc wrote:
On Saturday, 7 August 2021 at 12:08:00 UTC, Paul Backus wrote:
[...]

**First, thanks all for helping with this question!**

The simple desire to arbitrarily align an array is certainly looking non-trivial. Below is a simple program of both the suggested "struct" and "align array" solutions. Unfortunately, neither is guaranteed to place the array with the desired alignnment.

[...]

If you don't believe me just subtract the adresses yourself:

x.ptr:  7FFFF8D05B90
&x[0]7FFFF8D05B90
&x[1]7FFFF8D05BD0
&x[2]7FFFF8D05C10

 &x[1]  7FFFF8D05BD0
-&x[0] -7FFFF8D05B90
_____________________
        000000000040

0X40 = 64 in base 10

Your alignment requirement was 64 bytes

Reply via email to