svn commit: r186252 - head/sys/kern

ivoras at freebsd.org ivoras at freebsd.org
Sat Dec 27 21:20:02 UTC 2008


On 27/12/2008, Antoine Brodin <antoine at freebsd.org> wrote:
> On Wed, Dec 17, 2008 at 8:57 PM, Ivan Voras <ivoras at freebsd.org> wrote:

> Modified: head/sys/kern/subr_param.c
> [snip]
>> +enum VM_GUEST { VM_GUEST_NO, VM_GUEST_VM, VM_GUEST_XEN };
>> +
> [snip]
>> -               hz = detect_virtual() ? HZ_VM : HZ;
>> +               hz = vm_guest > VM_GUEST_NO ? HZ_VM : HZ;
> [snip]
>
> Hi Ivan,
>
> Could you change VM_GUEST_NO / VM_GUEST_VM / VM_GUEST_XEN to a #define
> or explicitly initialize them?
> The magnitude comparison between vm_guest and VM_GUEST_NO looks like
> gratuitous obfuscation.

I think that the "enum" type is very well defined and its behaviour
widely known so it is not necessary to break it into #defines. Would
you be happy if I explicitly initalized the first member of the enum
to signify its values are important?

enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };


More information about the svn-src-head mailing list