mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
* HACKING: Clarify "bool" vs. XDR/wire-format.
This commit is contained in:
parent
890915054f
commit
17bfd657b7
@ -1,3 +1,7 @@
|
|||||||
|
Tue Jan 13 11:44:32 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
* HACKING: Clarify "bool" vs. XDR/wire-format.
|
||||||
|
|
||||||
Mon Jan 12 22:07:57 CET 2009 Daniel Veillard <veillard@redhat.com>
|
Mon Jan 12 22:07:57 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* docs/index.html docs/index.html.in docs/relatedlinks.html
|
* docs/index.html docs/index.html.in docs/relatedlinks.html
|
||||||
|
5
HACKING
5
HACKING
@ -115,7 +115,10 @@ standard type like int32_t, uint32_t, uint64_t, etc.
|
|||||||
|
|
||||||
While using "bool" is good for readability, it comes with minor caveats:
|
While using "bool" is good for readability, it comes with minor caveats:
|
||||||
- Don't use "bool" in places where the type size must be constant across
|
- Don't use "bool" in places where the type size must be constant across
|
||||||
all systems, like public interfaces and on-the-wire protocols.
|
all systems, like public interfaces and on-the-wire protocols. Note
|
||||||
|
that it would be possible (albeit wasteful) to use "bool" in libvirt's
|
||||||
|
logical wire protocol, since XDR maps that to its lower-level bool_t
|
||||||
|
type, which *is* fixed-size.
|
||||||
- Don't compare a bool variable against the literal, "true",
|
- Don't compare a bool variable against the literal, "true",
|
||||||
since a value with a logical non-false value need not be "1".
|
since a value with a logical non-false value need not be "1".
|
||||||
I.e., don't write "if (seen == true) ...". Rather, write "if (seen)...".
|
I.e., don't write "if (seen == true) ...". Rather, write "if (seen)...".
|
||||||
|
Loading…
x
Reference in New Issue
Block a user