From: Jakub Jelinek <jakub@redhat.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Maciej Soltysiak <solt@dns.toxicfilms.tv>,
Greg KH <greg@kroah.com>, Matthew Wilcox <willy@debian.org>,
Robert Love <rml@tech9.net>, CaT <cat@zip.com.au>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
kernel-janitor-discuss@lists.sourceforge.net
Subject: Re: C99 Initialisers
Date: Tue, 12 Aug 2003 06:19:13 -0400 [thread overview]
Message-ID: <20030812061913.G28314@devserv.devel.redhat.com> (raw)
In-Reply-To: <Pine.GSO.4.21.0308121202470.20533-100000@vervain.sonytel.be>; from geert@linux-m68k.org on Tue, Aug 12, 2003 at 12:03:21PM +0200
On Tue, Aug 12, 2003 at 12:03:21PM +0200, Geert Uytterhoeven wrote:
> > > I sure would. Oh, you can drop the .class, .class_mask, and
> > > .driver_data lines, and then it even looks cleaner.
> > Just a quick question. if we drop these, will they _always_
> > be initialised 0 ? I have made a test to see, and it seemed as though,
> > but I would like to be 100% sure.
>
> For globals and static locals: yes.
> For non-static locals: no.
No, for all initializers members which are not explicitely initialized are
zero initialized.
Only if you provide no initializer at all, globals/static locals will
still be zero initializers while non-static locals may contain anything.
So, if you write:
struct A { int a; int b; int c; int d; };
void bar (void *);
void foo (void)
{
struct A a = { .a = 21 };
bar (&a);
}
then it is the same as:
struct A { int a; int b; int c; int d; };
void bar (void *);
void foo (void)
{
struct A a = { .a = 21, .b = 0, .c = 0, .d = 0 };
bar (&a);
}
Jakub
next prev parent reply other threads:[~2003-08-12 10:19 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-12 2:02 C99 Initialisers CaT
2003-08-12 2:18 ` Robert Love
2003-08-12 2:39 ` Matthew Wilcox
2003-08-12 2:45 ` Robert Love
2003-08-12 2:57 ` Dagfinn Ilmari Mannsåker
2003-08-12 5:38 ` Greg KH
2003-08-12 9:01 ` Maciej Soltysiak
2003-08-12 10:03 ` Geert Uytterhoeven
2003-08-12 10:19 ` Jakub Jelinek [this message]
2003-08-12 11:27 ` Matthew Wilcox
2003-08-12 16:54 ` Ian Hastie
2003-08-12 18:01 ` Greg KH
2003-08-12 23:53 ` Dave Jones
2003-08-13 0:08 ` Matthew Wilcox
2003-08-13 0:23 ` Greg KH
2003-08-13 0:31 ` Matthew Wilcox
2003-08-14 5:45 ` H. Peter Anvin
2003-08-13 15:52 ` Timothy Miller
2003-08-13 17:50 ` Jeff Garzik
2003-08-13 0:02 ` Jeff Garzik
2003-08-13 0:14 ` Randy.Dunlap
2003-08-13 0:31 ` Jeff Garzik
2003-08-13 0:37 ` Randy.Dunlap
2003-08-13 0:49 ` Dave Jones
2003-08-13 1:25 ` Jeff Garzik
2003-08-13 3:02 ` Randy.Dunlap
2003-08-13 3:26 ` Jeff Garzik
2003-08-13 10:14 ` David S. Miller
2003-08-13 17:31 ` Greg KH
2003-08-13 17:36 ` David S. Miller
2003-08-13 17:47 ` Jeff Garzik
2003-08-13 18:02 ` Greg KH
2003-08-13 18:26 ` Jeff Garzik
2003-08-13 18:38 ` Russell King
2003-08-13 19:44 ` Jeff Garzik
2003-08-13 19:54 ` Matthew Wilcox
2003-08-13 20:15 ` Greg KH
2003-08-13 20:16 ` Dave Jones
2003-08-13 20:30 ` Matt Domsch
2003-08-13 20:29 ` Jeff Garzik
2003-08-13 21:05 ` Sam Ravnborg
2003-08-13 22:24 ` Roman Zippel
2003-08-14 20:31 ` Sam Ravnborg
2003-08-14 10:05 ` Geert Uytterhoeven
2003-08-14 10:25 ` Gene Heskett
2003-08-14 10:52 ` jw schultz
2003-08-14 12:34 ` Geert Uytterhoeven
2003-08-14 12:57 ` Andrey Panin
2003-08-14 18:45 ` H. Peter Anvin
2003-08-13 21:06 ` Russell King
2003-08-13 21:17 ` Eduardo Pereira Habkost
2003-08-13 17:50 ` Sam Ravnborg
2003-08-13 17:54 ` Jeff Garzik
2003-08-13 17:54 ` Matthew Wilcox
2003-08-13 17:58 ` Jeff Garzik
2003-08-13 18:03 ` Greg KH
2003-08-13 17:58 ` Greg KH
2003-08-13 18:21 ` Sam Ravnborg
2003-08-13 18:09 ` Russell King
2003-08-13 20:21 ` Krzysztof Halasa
2003-08-13 21:17 ` David S. Miller
2003-08-13 21:26 ` Greg KH
2003-08-14 22:46 ` Krzysztof Halasa
2003-08-12 17:37 ` Dave Jones
2003-08-12 17:48 ` Matthew Wilcox
2003-08-12 22:06 ` Ian Hastie
2003-08-13 15:54 ` CaT
2003-08-14 6:57 ` Maciej Soltysiak
-- strict thread matches above, loose matches on Subject: below --
2003-08-12 16:52 Shureih, Tariq
[not found] <jFFu.7t8.15@gated-at.bofh.it>
[not found] ` <jLKX.4KI.13@gated-at.bofh.it>
[not found] ` <jRnj.2dx.11@gated-at.bofh.it>
[not found] ` <jRwZ.2kJ.15@gated-at.bofh.it>
[not found] ` <jRQi.2zQ.5@gated-at.bofh.it>
[not found] ` <jRZY.2Hw.5@gated-at.bofh.it>
[not found] ` <jS9J.2Np.5@gated-at.bofh.it>
[not found] ` <jUbt.57S.7@gated-at.bofh.it>
[not found] ` <jUuT.5kZ.13@gated-at.bofh.it>
[not found] ` <k13k.22O.3@gated-at.bofh.it>
[not found] ` <k7Lq.7Gr.7@gated-at.bofh.it>
2003-08-13 21:19 ` junkio
2003-08-13 22:18 ` Greg KH
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=20030812061913.G28314@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=cat@zip.com.au \
--cc=geert@linux-m68k.org \
--cc=greg@kroah.com \
--cc=kernel-janitor-discuss@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
--cc=solt@dns.toxicfilms.tv \
--cc=willy@debian.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