What is the cost of sizeof?
I would expect:
The sizeof
construct in C is a completely compile time construct. There is no runtime cost.
There is at least one exception to this rule: variable length arrays. The size of these arrays are computed at runtime and that size is reused for any sizeof
operators applied to them.
Please note there is a difference between a variable length array and a dynamic one. Variable length arrays were added in C99 and they do support the sizeof operator