document caveats of quit (#17648)

This commit is contained in:
Timothee Cour
2021-04-05 12:19:17 -07:00
committed by GitHub
parent 5261579175
commit 28de32c8b2

View File

@@ -1185,10 +1185,6 @@ when defined(nimdoc):
##
## Before stopping the program the "exit procedures" are called in the
## opposite order they were added with `addExitProc <exitprocs.html#addExitProc,proc)>`_.
## `quit` never returns and ignores any exception that may have been raised
## by the quit procedures. It does *not* call the garbage collector to free
## all the memory, unless a quit procedure calls `GC_fullCollect
## <#GC_fullCollect>`_.
##
## The proc `quit(QuitSuccess)` is called implicitly when your nim
## program finishes without incident for platforms where this is the
@@ -1199,6 +1195,14 @@ when defined(nimdoc):
## have any compile time effect. If you need to stop the compiler inside a
## macro, use the `error <manual.html#pragmas-error-pragma>`_ or `fatal
## <manual.html#pragmas-fatal-pragma>`_ pragmas.
##
## .. danger:: In almost all cases, in particular in library code, prefer
## alternatives, e.g. `doAssert false` or raise a `Defect`.
## `quit` bypasses regular control flow in particular `defer`,
## `try`, `catch`, `finally` and `destructors`, and exceptions that may have been
## raised by an `addExitProc` proc, as well as cleanup code in other threads.
## It does *not* call the garbage collector to free all the memory,
## unless an `addExitProc` proc calls `GC_fullCollect <#GC_fullCollect>`_.
elif defined(genode):
include genode/env