X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=doc%2Fapi%2Flibbabeltrace2%2Fdox%2Fapi-fund.dox;fp=doc%2Fapi%2Flibbabeltrace2%2Fdox%2Fapi-fund.dox;h=5b24faf4e3c2b76fdf3d3fe0f5a1a57dbf304484;hp=8c60e539f614c5d138fe095776e7ef8d6eef0d73;hb=1778c2a4134647150b199b2b57130817144446b0;hpb=e020d1340a9b5ebd7d7dbf00a2c34d2fe512a495
diff --git a/doc/api/libbabeltrace2/dox/api-fund.dox b/doc/api/libbabeltrace2/dox/api-fund.dox
index 8c60e539..5b24faf4 100644
--- a/doc/api/libbabeltrace2/dox/api-fund.dox
+++ b/doc/api/libbabeltrace2/dox/api-fund.dox
@@ -24,34 +24,51 @@ directory: the compiler prints an error when you try to.
- All libbabeltrace2 definitions, macros, and enumerators start
with \c BT_.
-@section api-fund-pre-post Function precondition and postcondition checking
+@section api-fund-pre-post Function contract checking
-All the functions of libbabeltrace2 which have parameters check that
-the caller meets their
+All the functions of libbabeltrace2 check that the caller meets their
preconditions.
-All the functions of libbabeltrace2 which call a user function which
-returns something check that the returned value meets their
-postconditions.
+All the functions of libbabeltrace2 which call a user function check
+that it meets its
+postconditions
+when it returns.
The function descriptions in the
API reference modules
list all their preconditions and postconditions, if any.
-libbabeltrace2 is very strict regarding function preconditions and
-postconditions: when you break any of them, the library prints how the
-precondition or postcondition was not satisfied, with details, and then
-calls abort()
.
+The libbabeltrace2 public functions offer a
+narrow contract: when you break it, the library
+prints how the precondition or postcondition was not satisfied, with
+details, and then calls abort()
.
Here's an example of what the library prints to the standard error
-before aborting when you break a precondition:
+before aborting when you break a precondition (call
+bt_value_bool_set() with a \c NULL value);
+\ref api-fund-logging "logging" prefixes are removed for clarity:
@code{.unparsed}
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Babeltrace 2 library precondition not satisfied; error is:
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Value object is NULL:
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Aborting...
+Babeltrace 2 library precondition not satisfied.
+------------------------------------------------------------------------
+Condition ID: `pre:value-bool-set:not-null:value-object`.
+Function: bt_value_bool_set().
+------------------------------------------------------------------------
+Error is:
+Value object is NULL.
+Aborting...
@endcode
+In the output above:
+
+- pre:value-bool-set:not-null:value-object
is the unique,
+ permanent ID of this precondition.
+
+ We use this ID for internal libbabeltrace2 testing.
+
+- The Function:
line shows which function's contract was
+ broken.
+
Because precondition and postcondition checks detect programming errors,
libbabeltrace2's approach is to abort as soon as possible so that you
fix the error. Therefore, the libbabeltrace2 functions never return a