[bind10-dev] Enums as array indices and manual vs. auto-numbering
Shane Kerr
shane at isc.org
Thu Aug 25 19:47:27 UTC 2011
Michal,
On Thu, 2011-08-25 at 13:50 +0200, Michal 'vorner' Vaner wrote:
> AFAIK our code guideline suggests that whenever we write an enum, we should
> manually assign numbers to it:
>
> enum X {
> A = 0,
> B = 1
> };
As far as I can tell the coding guidelines are silent on this particular
issue:
http://bind10.isc.org/wiki/CodingGuidelines
We happen to have one example of enumerations in the "Naming" section,
which looks like this:
enum EnumName {
THING_ONE = 1,
THING_TWO = 2
} enum_instance;
So maybe that was interpreted to mean that we always use manually
assigned values.
Like Jinmei, I also have no strong preference, but I tend to lean
towards preferring allowing the default values. If we need manually
assigned values we should use them, but otherwise not.
--
Shane
More information about the bind10-dev
mailing list