[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] [PATCH] Remove MAX_TAP_ID, take 3
- From: Aron Griffis <aron griffis hp com>
- To: Matthias Bolte <matthias bolte googlemail com>
- Cc: libvir-list redhat com
- Subject: Re: [libvirt] [PATCH] Remove MAX_TAP_ID, take 3
- Date: Thu, 30 Jul 2009 09:57:24 -0400
Matthias Bolte wrote: [Thu Jul 30 2009, 06:04:40AM EDT]
> 2009/7/30 Mark McLoughlin <markmc redhat com>:
> > On Thu, 2009-07-30 at 02:58 +0200, Matthias Bolte wrote:
> >>
> >> The follow change makes GCC happy again:
> >>
> >> - struct ifreq ifr = {0};
> >> + struct ifreq ifr = {{{0}}, {{0, {0}}}};
> >
> > AFAIR, this works?
> >
> > struct ifreq ifr = {0,};
> >
> > Cheers,
> > Mark.
> >
>
> No, it doesn't, I tested it. The problem is the internal structure of
> ifreq. GCC complains until the initializer matches this structure. Or
> use memset like all other bridge functions do:
>
> struct ifreq ifr;
> memset(&ifr, 0, sizeof(struct ifreq));
It's unfortunate, really... In general, one would prefer to ask
the compiler for a zeroed structure on the stack than to call
memset, which clutters the code and reduces the opportunity for
the compiler to optimize. For arrays, {0} works with -Wall
-Werror; the unspecified elements are zeroed. But it looks like
there's no simple zero-initializer for structs.
Aron
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]