On Thu, 05 Jan 2012 23:22:34 -0400, David Bremner <[email protected]> wrote:
> On Thu,  5 Jan 2012 22:25:12 +0200, Jani Nikula <[email protected]> wrote:
> > -    notmuch_show_params_t params;
> > +    notmuch_show_params_t params = { .part = -1 };
> >  
> >      reply_format_func = notmuch_reply_format_default;
> > -    params.part = -1;
> 
> Do I understand correctly that this is just a style change, or do you
> rely on some c99(?) behaviour of initializing the other elements to 0?

It is not just a style change, and initializing a struct partially
initializes the rest of the elements to 0. That's not C99 specific
behaviour, though using the designated initializer to initialize .part
to -1 is.

All of these result in the same value for params:

        notmuch_show_params_t params = { .part = -1 };

        notmuch_show_params_t params = { 0, 0, -1 };

        notmuch_show_params_t params = { 0, 0, -1, NULL, 0 };

        notmuch_show_params_t params = { 0 };
        params.part = -1;

IMHO the first is cleanest and unaffected by changes in
notmuch_show_params_t, though might be surprising if you're not (yet)
used to C99 designated initializers.

In any case, in the current implementation only .part and .cryptoctx are
initialized, and the rest of the fields are random. This needs to be
fixed one way or another.


BR,
Jani.
_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to