linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randi Botse <nightdecoder@gmail.com>
To: Guillaume Leconte <guillaume.leconte@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: C Question
Date: Tue, 25 May 2010 17:49:54 +0700	[thread overview]
Message-ID: <AANLkTikPPM6DhdUB6bTujgBgg9pDmuJCUVRnn3uvbULx@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinTu94E7guvzjySpGjht2Hjw4aop4vRIVpHo9UL@mail.gmail.com>

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@gmail.com> 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@vger.kernel.org
>> > 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@vger.kernel.org
>> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-05-25 10:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 10:08 C Question Randi Botse
2010-05-25 10:19 ` Xiaotian Feng
     [not found]   ` <AANLkTinTu94E7guvzjySpGjht2Hjw4aop4vRIVpHo9UL@mail.gmail.com>
2010-05-25 10:49     ` Randi Botse [this message]
2010-05-25 11:18 ` Uriel Corfa
2010-05-25 11:41 ` Michal Nazarewicz
2010-05-30 10:41   ` Randi Botse
2010-05-30 12:38     ` Michal Nazarewicz
2010-06-01 11:59       ` Randi Botse
2010-06-01 13:18         ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikPPM6DhdUB6bTujgBgg9pDmuJCUVRnn3uvbULx@mail.gmail.com \
    --to=nightdecoder@gmail.com \
    --cc=guillaume.leconte@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).