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
// Depending on the size a particular value, Go determines the alignment we need. Every 2 bytes
// value must follow a 2 bytes boundary. Since the bool value is only 1 byte and start at
// address 0, then the next int16 must start on address 2. The byte at address that get skipped
// over becomes a 1 byte padding. Similarly, if it is a 4 bytes value then we will have a 3
// bytes padding value.
The first rule's statements are really hard to comprehend if it's your first time dealing with data structure alignments. Please, correct me if I'm wrong.
Every 2 bytes value must follow a 2 bytes boundary.
It is really hard sentence to start this explanation, because it does not imply what to do with other cases, e.g. if you put 1 byte value, it must be followed by 1 byte boundary, etc. The reader may not conclude that this implies even further for 2, 4, 8 byte values (I'm not sure for Go case, but this statement may depend on specific architecture).
Similarly, if it is a 4 bytes value then we will have a 3 bytes padding value.
Here, you don't point out that you are referring on the same example with setting 1 byte value on the beginning of the 8 byte block. I was thinking that you just appended value of pi to complete explaining alignment in that specific struct
I don't say that something here is wrong, but it's hard to understand. Maybe it should be revisited or put some references like this to be easier to understand.
The text was updated successfully, but these errors were encountered:
ultimate-go/go/language/struct.go
Lines 29 to 34 in 3fb5ca6
The first rule's statements are really hard to comprehend if it's your first time dealing with data structure alignments. Please, correct me if I'm wrong.
It is really hard sentence to start this explanation, because it does not imply what to do with other cases, e.g. if you put 1 byte value, it must be followed by 1 byte boundary, etc. The reader may not conclude that this implies even further for 2, 4, 8 byte values (I'm not sure for Go case, but this statement may depend on specific architecture).
Here, you don't point out that you are referring on the same example with setting 1 byte value on the beginning of the 8 byte block. I was thinking that you just appended value of pi to complete explaining alignment in that specific struct
I don't say that something here is wrong, but it's hard to understand. Maybe it should be revisited or put some references like this to be easier to understand.
The text was updated successfully, but these errors were encountered: