[cfe-dev] question about initializing multiple members of unions

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Mon Sep 16 14:21:34 PDT 2013


> How can it give that result? agg_instance.a.zero and agg_instance.a.two were never initialized.

I guess I see your point. I was just not comfortable with having unspecified values in the end result of an
initializer list; my interpretation of 6.7.9p19 is that they all should be initialized to something. But unions are
special since you also have to apply 6.2.6.1p7.

Well, if a.zero and a.two were not initialized, and if I apply 6.7.9p19, they should be initialized to zero, right?
And a.one will be initialized to 1. The end result will be {0, 1, 0, 3} ?




More information about the cfe-dev mailing list