Re: C Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, that's i was talking about, i got the idea, gcc even let me
declared "unordered" subobject index like this..

const char *my_strings[] = {
            [0] = "string1",
            [2] = "string2",
            [1] = "string3",
            etc...
}

Actually, this is my first time seeing codes like this, it was strange
for me :p, many thanks for let me know!

- Randi,


On Tue, May 25, 2010 at 5:24 PM, Guillaume Leconte
<guillaume.leconte@xxxxxxxxx> wrote:

> I think he is talking about the [VIRT_NONE] = ... style, which is C99.
>
>>
>> > /* 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")
>> > };
>
> It is equivalent to:
>
> const char *virt_types[3];
>
> virt_types[VIRT_NONE] = N_("none");
> virt_types[VIRT_PARA] = N_("para");
> virt_types[VIRT_FULL] = N_("full");
>
>
>>
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe
>> > linux-c-programming" in
>> > the body of a message to majordomo@xxxxxxxxxxxxxxx
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >
>> --
>> To unsubscribe from this list: send the line "unsubscribe
>> linux-c-programming" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> « I've seen things you people wouldn't believe.  Attack ships on fire
> off the shoulder of Orion.  I watched C-beams glitter in the dark near
> the Tanhauser gate.  All those moments will be lost in time like tears
> in rain.  Time to die. »
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux