Another counter-example to the else
claim, which I think goes back to K&R C:
void do_something() {}
do
if (1) do_something(); else do_something();
while(0);
The do
is required to be followed by exactly one statement. if (condition) statement; else statement;
constitutes one statement, but eliminating the else
would cause it to be two statements.
As for struct vs union, given
typedef union {int x, y; } t;
t a[3] = {1,2,3};
I think a compiler would be required to store the 3 into a[2].x
(also known as a[2].y
), and would have nowhere to store any additional initialization values. If t
had been a struct, the 3 would have gone into a[1].x
, and there would have been room for three more values.