You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First and foremost, I appreciate you taking the time to make zig.guide, so thank you for being a maintainer.
Caveat: I could be completely wrong here, I'm just going from what I understand, and there's a good chance you know more than me, but I thought I'd mention anyway in case you agree.
[1] For circuitry reasons, CPUs access primitive values at specific multiples in memory. This could mean, for example, that the address of an f32 value must be a multiple of 4, meaning f32 has an alignment of 4. This so-called "natural alignment" of primitive data types depends on CPU architecture. All alignments are powers of 2.
[2] Data of a larger alignment also has the alignment of every smaller alignment; for example, a value which has an alignment of 16 also has an alignment of 8, 4, 2 and 1.
[2] seems (to perhaps only me) to be contradictory to [1]: [2] seems to imply to me that an f32 can be stored at a memory address that is byte or even half-word aligned, in direct violation of what [1] is saying(?). I may be rusty on my CPU arch, but that's the wrong interpretation of what you wish to convey, right?
The text was updated successfully, but these errors were encountered:
Furthermore, I'd like to suggest that the examples could do with perhaps either some comments or maybe diagrams of extra allocated memory or word/half-word partitioning (or whatever the best technical terms are)
First and foremost, I appreciate you taking the time to make zig.guide, so thank you for being a maintainer.
Caveat: I could be completely wrong here, I'm just going from what I understand, and there's a good chance you know more than me, but I thought I'd mention anyway in case you agree.
Issue
https://zig.guide/working-with-c/alignment
The page here reads:
[2] seems (to perhaps only me) to be contradictory to [1]: [2] seems to imply to me that an
f32
can be stored at a memory address that is byte or even half-word aligned, in direct violation of what [1] is saying(?). I may be rusty on my CPU arch, but that's the wrong interpretation of what you wish to convey, right?The text was updated successfully, but these errors were encountered: