Re: [PATCH 2/7] Remove vlang_unknown

Joel Brobecker
2013-10-02T09:32:52Z

> > In varobj.c:varobj_create, variable_language returns
> > 'enum varobj_languages', and use it as an index to array
> > languages.
> >
> > /* Set language info */
> > lang = variable_language (var);
> > var->root->lang = &languages[lang];
> >
> > that is the reason the first enum should be zero.
>
> While we know enums begin at zero, making it explicit is fine with me.
>
> But if there's a reason that needed explaining, a comment in the code
> explaining "Why things are the way they are"
> is most welcome.

I agree. I think the patch is OK to go with a quick comment added,
explaining that we want to be able to index arrays using this enum,
so we make its first enum explicitly zero (despite the fact that
this is the default, this prevents someone else just accidently
setting the first enum's value to nonzero for other reasons).

--
Joel