Language lawyer question #2 for the day: find chapter and verse of the C standard that either guarantees that sizeof(array of n Type) == n*sizeof(Type) or allows otherwise.
-
Show this thread
-
Replying to @stephentyrone
While examples may not be normative, EXAMPLE 2 under "6.5.3.4 The sizeof and _Alignof operators" covers it.
1 reply 0 retweets 1 like -
Replying to @RichFelker @stephentyrone
"Another use of the sizeof operator is to compute the number of elements in an array: sizeof array / sizeof array[0]"
1 reply 0 retweets 1 like -
Replying to @RichFelker @stephentyrone
#Technically that just implies that the amount of tail padding must be strictly less than the size of an element…!2 replies 2 retweets 15 likes -
There is nothing in the standard about padding for arrays, and that's a fact.
1 reply 0 retweets 2 likes -
Yes, the whole confusion seems to be thinking unrelated text about padding bits in basic types or internal or trailing padding in structs could magically apply to arrays.
1 reply 0 retweets 0 likes
There's no language about padding for arrays, and the (overly terse) spec for the repr of arrays is just "contiguous set of objects" (determined by their repr).
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.