linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Uriel Corfa <uriel@corfa.fr>
To: Randi Botse <nightdecoder@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: C Question
Date: Tue, 25 May 2010 13:18:48 +0200	[thread overview]
Message-ID: <AANLkTimyPhCRO-g2i1keSaZqiEcJz1L4SwsPuHuiV5RP@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimNataepVFhtn4kSv_kGv1wTBHMAOgeZTK0hgW-@mail.gmail.com>

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

  parent reply	other threads:[~2010-05-25 11:18 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
2010-05-25 11:18 ` Uriel Corfa [this message]
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=AANLkTimyPhCRO-g2i1keSaZqiEcJz1L4SwsPuHuiV5RP@mail.gmail.com \
    --to=uriel@corfa.fr \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=nightdecoder@gmail.com \
    /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).