On Thu, Feb 08, 2018 at 12:25:24PM +0100, Christophe de Dinechin wrote: > From: Christophe de Dinechin <[email protected]> > > Signed-off-by: Christophe de Dinechin <[email protected]> > --- > docs/spice_style.txt | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/docs/spice_style.txt b/docs/spice_style.txt > index 13032df6..eef4880f 100644 > --- a/docs/spice_style.txt > +++ b/docs/spice_style.txt > @@ -99,10 +99,19 @@ FIXME and TODO > > Comments that are prefixed with `FIXME` describe a bug that need to be > fixed. Generally, it is not allowed to commit new code having `FIXME` > comment. Committing `FIXME` is allowed only for existing bugs. Comments that > are prefixed with `TODO` describe further features, optimization or code > improvements, and they are allowed to be committed along with the relevant > code. > > -ASSERT > ------- > +Assertions > +---------- > + > +Use assertions liberally. Assertions help testing function arguments > and function results validity. As a result, they make it easier to > detect bugs. Also, by expressing the intent of the developer, they > make the code easier to read. +
Given the rest of the thread, it's not clear if you mean "assertions which abort the program", or runtime checks such as g_warn_if_fail()/g_return_if_fail()/... I'm very much in favour of using the latter functions liberally. I think we should avoid as much as possible the use of anything calling abort(), especially in library code. If a user can get the abort() to trigger, that means they can just kill their VM, which is not a nice thing to do ;) So one should really think hard before adding a g_assert() in the code. Christophe
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/spice-devel
