[libvirt] [PATCH] docs: Format bit shift notation for bitwise flag enums

Daniel P. Berrangé berrange at redhat.com
Tue Jan 29 13:07:04 UTC 2019


On Thu, Jan 24, 2019 at 03:43:15PM +0100, Peter Krempa wrote:
> Big number itself does not make much sense in some cases. Format the
> bitshift format as well.
> 
> Changes our web page docs from:
> 
> VIR_MIGRATE_POSTCOPY = 32768 : Setting the VIR_MIGRATE_POSTCOPY...
> VIR_MIGRATE_TLS      = 65536 : Setting the VIR_MIGRATE_TLS flag...
> 
> to:
> 
> VIR_MIGRATE_POSTCOPY = 32768 (1<<15) : Setting the VIR_MIGRATE_POSTCOPY...
> VIR_MIGRATE_TLS      = 65536 (1<<16) : Setting the VIR_MIGRATE_TLS flag...

I tend to question why we are reporting the value in the docs at all.

The whole point of enums/constants is that developers should never care
about the actual. They should exclusively use the names.

So if anything I'd suggest we remove the existing numbers from the docs,
instead of adding the bitshift values.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list