On 10/10/14, 11:13 AM, "Eric Blake" <eblake(a)redhat.com> wrote:
On 10/10/2014 10:59 AM, Anirban Chakraborty wrote:
> The list is really very long to put all in here. If we have to do what
>you
> suggested, then we¹d be changing all such usage of switch statements,
> which is not trivial, I believe.
The point of adding it to HACKING is to encourage new code to abide by
the standard, and not necessarily to retrofit existing code. And you
are correct that existing code doesn't always use enum type-safety
compiler guarantees - which makes the enum that much harder to modify
later if we ever add enum values. But in some cases, it is fairly
obvious that we don't plan to add any enum values, in which case a
simple if statement or use of a default label is fine. It's a
case-by-case judgment call of what makes the code easier to maintain.
So, you are proposing not to touch the existing code but do it for all new
code addition. I do not have any problem with that, except for the fact
that this would bloat new code, which is equally important, IMHO. Should
we bloat code to future proof coding error? If other folks think yes we
should (in the context of this code), then I¹d be more than happy to swap
the Œdefault¹ case with rest of the types of virDomainNetType.
Anirban