@@ -2867,12 +2867,12 @@ automatically modifies all the rest. The largest union member defines the size o
28672867
28682868One reason, as stated above, is to use less memory for storing things. Since the size of a union
28692869is the size of the largest field in it, and the size of a struct is the size of all the fields in
2870- struct added together, a union is definitely better for lower memory usage. As long as you only
2871- need one of the fields to be valid at any time, the union wins.
2870+ the struct added together, a union is definitely better for lower memory usage. As long as you
2871+ only need one of the fields to be valid at any time, the union wins.
28722872
28732873Another reason is to allow easier access to parts of a field. For example, without using a union,
28742874if you want to look at each of the bytes of a 32-bit integer separately, you'll need bitwise
2875- RIGHT-SHIFTs and AND operations. With a union, you can access the individual bytes directly.
2875+ ` RIGHT-SHIFT ` s and ` AND ` operations. With a union, you can access the individual bytes directly.
28762876``` v
28772877union ThirtyTwo {
28782878 a u32
@@ -8397,4 +8397,4 @@ This is the place to be, to discuss the V language, learn about latest
83978397developments, quickly get help with issues, witness/participate in
83988398~~epic flame wars~~ constructive criticism exchanges and design decisions.
83998399Join it, and learn more about languages, games, editors, people, Klingons,
8400- Conway' s law and the universe.
8400+ Conway' s law and the universe.
0 commit comments