assert.3 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .TH ASSERT 3 "$Revision$"
  2. .ad
  3. .SH NAME
  4. assert \- program verification
  5. .SH SYNOPSIS
  6. .B #include <assert.h>
  7. .PP
  8. .B assert(expression)
  9. .PP
  10. .B _BadAssertion(fn, lino, ass)
  11. .br
  12. char *fn, *ass;
  13. .br
  14. unsigned int lino;
  15. .SH DESCRIPTION
  16. .PP
  17. .I Assert
  18. is a macro that indicates
  19. .I expression
  20. is expected to be true at this point in the program.
  21. It causes a call to
  22. .I _BadAssertion
  23. when
  24. .I expression
  25. is false (0).
  26. .PP
  27. The routine
  28. .I_BadAssertion
  29. accepts three parameters:
  30. a filename, a linenumber,
  31. and a string representing a failed assertion.
  32. It causes a
  33. .IR sys_stop (S_ABORT)
  34. with a diagnostic comment on standard error.
  35. .PP
  36. The assertions are disabled by defining the preprocessor constant NDEBUG.
  37. .SH DIAGNOSTICS
  38. .IR fn ,
  39. line
  40. .IR lino :
  41. assertion
  42. .I ass
  43. failed.
  44. .br
  45. .I fn
  46. is the source file,
  47. .I lino
  48. is the source line number,
  49. and
  50. .I ass
  51. is the assertion
  52. of the
  53. .I assert
  54. statement.
  55. .SH MODULES
  56. system(3)
  57. .SH FILES
  58. .nf
  59. ~em/modules/h/assert.h
  60. ~em/modules/lib/libassert.a
  61. .fi