Re: C Question
Uriel Corfa <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
That's "designated initializers". It's C99. It allows you to initialize some members to a specific value without specifying the default value manually for the other ones. Refs : http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf chapter 6.7.8.6 http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/designators.htm On Tue, May 25, 2010 at 12:08 PM, Randi Botse <[email protected]> wrote: > Hi All, > > Im looking at lscpu.c shipped by util-linux-ng-2.17, can you explain > me how the *vir_types[] declared, is this valid C declaration? > > /* virtualization types */ > enum { > VIRT_NONE = 0, > VIRT_PARA, > VIRT_FULL > }; > const char *virt_types[] = { > [VIRT_NONE] = N_("none"), > [VIRT_PARA] = N_("para"), > [VIRT_FULL] = N_("full") > }; > -- > To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in > the body of a message to [email protected] > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Uriel Corfa -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html