Re: C Question

Randi Botse <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
Yes, the N_(x) macro used for localization that i discard in my question.

Sorry but, i just having another question, consider this code:

const char *my_strings[] = {
    [0] = "index0",
    [4] = "index4",
    [6] = "index6"
};

How many pointer to char that my_string array holds now? is that 3?
where are index [1], [2], [3], and [5] ?

2010/5/25 Michal Nazarewicz <[email protected]>:
>
> As Xiaotian Feng said, N_(x) must be defined somewhere and additionally
> to this this definition uses a new syntax where you can specify indexes
> of elements you want to set value to, ie. the above is the same as:
>
> const char *virt_types[] = {
>        [0]     = N_("none"),
>        [1]     = N_("para"),
>        [2]     = N_("full")
> };
>
> which in turn is the same as:
>
> const char *virt_types[] = {
>        N_("none"),
>        N_("para"),
>        N_("full")
> };
>
> The advantage of the new syntax is that you can specify values in any
> order and omit some.
>
> --
> Best regards,                                         _     _
>  .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
>  ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
>  ooo +--<mina86-tlen.pl>--<jid:mina86-jabber.org>--ooO--(_)--Ooo--
>
--
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.