From: "Gorka Guardiola" <paurea@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Subject: Re: [9fans] initialization of anonymous structs.
Date: Thu, 4 Dec 2008 13:26:55 +0100 [thread overview]
Message-ID: <599f06db0812040426u435f5a9dx7c1c0209c333db53@mail.gmail.com> (raw)
In-Reply-To: <599f06db0812040407g59ee4feejc79ce8ecdec30451@mail.gmail.com>
On Thu, Dec 4, 2008 at 1:07 PM, Gorka Guardiola <paurea@gmail.com> wrote:
> Say I have a couple of structs like:
>
> typedef struct A A;
> typedef struct B B;
>
> struct A
> {
> int a1;
> int a2;
> };
>
> struct B
> {
> A;
> int b1;
> int b2;
> };
>
> Now I want to declare a variable of kind B with parts initialized. Is
> there anyway to initialize the A inside the B?. I have tried:
>
> B bvar = {
> .a1 2
> .b1 2
> };
>
There is a way, with a display, but I wanted to name the fields.
This works:
B bvar = {
0,
0,
0,
0
};
I guess I can always add comments.
--
- curiosity sKilled the cat
next prev parent reply other threads:[~2008-12-04 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-04 12:07 Gorka Guardiola
2008-12-04 12:26 ` Gorka Guardiola [this message]
2008-12-04 12:33 ` Sape Mullender
2008-12-04 14:56 ` roger peppe
2008-12-04 15:16 ` erik quanstrom
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=599f06db0812040426u435f5a9dx7c1c0209c333db53@mail.gmail.com \
--to=paurea@gmail.com \
--cc=9fans@9fans.net \
/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).