On Thu, Dec 11, 2014 at 8:36 AM, Thomas Gleixner <t...@linutronix.de> wrote:
> On Wed, 10 Dec 2014, Yinghai Lu wrote:
>> On Wed, Dec 10, 2014 at 12:15 PM, Thomas Gleixner <t...@linutronix.de> wrote:
>> >> -       struct resource r = {
>> >> -               .flags = 0
>> >> -       };
>> >> +       struct resource r;
>> >>
>> >> +       memset(&r, 0, sizeof(r));
>> >
>> > What's the point of this change? Both initialize r to 0. memset()
>> > generates better code, but that's irrelevant for the problem at hand.
>
> Did you actually read what I wrote?
>
>         struct resource r = {
>                .flags = 0
>         };
>
> initializes r completely to 0. So how do you get a random pointer in r?

ok, I get it now.

I was thinking that compiler will generate code like
    struct resource r;
    r.flags = 0;

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to