Why does sizeof(void) == 1?

c, gcc

Solution

`sizeof(void)` will not compile on a C compiler.

ISO 9899:2011 6.2.5/19

"The void type comprises an empty set of values; it is an incomplete object type that cannot be completed."

ISO 9899:2011 6.5.3.4/1

"The sizeof operator shall not be applied to an expression that has function type or an incomplete type"

This is normative text: sizeof(void) is not valid C.

Problem

Possible Duplicate: What is the size of void? In §6.2.5.19, the prophets let us know that: The `void` type comprises an empty set of values Then why does `sizeof(void)` yield 1, when 0 seems to suffice?

Original source

Related problems