add a 'append' mode for the ringbuffer
[nobug.git] / doc / macros.txt
blobf43d3924415ab90a871977f2db0c2895104824f8
1 HEAD- Macros;;
3 The NoBug interface is almost completely implemented using
4 preprocessor macros. This is required because NoBug uses the
5 `+++__FILE__+++` and `+++__LINE__+++` macros to log information on the
6 current file and the current line number within that file. Moreover,
7 all the flat namespace uppercase identifiers make it ease to recognise
8 the macros in source code.
10 All macros are available without condition with a `NOBUG_...` prefix.
11 Macros are also available without this prefix as a convenience,
12 however macros without this prefix must not have been previously
13 defined. When `NOBUG_DISABLE_SHORTNAMES` is defined before including
14 'nobug.h', then only the `NOBUG_` prefixed macros are available and
15 the short forms will never be defined.
17 All assertion and logging macros have a corresponding form
18 postfixed by `..._DBG`. Such macros will only be active within a
19 debugger.
21 A set of macros are provided by NoBug that are postfixed by `..._IF`.
22 These macros have the following form:
24   * `..._IF(when, ...)`
26 They perform the desired action only if `when` is true. For example:
28   * `REQUIRE_IF(foo != NULL, foo->something == constrained)`
30 The assertion will only be performed if `foo` is non `NULL`.
32 Debugger versions are available using `..._IF_DBG` postfixed to the name
33 of the macro.