document caveats of quit (#17648)
This commit is contained in:
parent
5261579175
commit
28de32c8b2
1 changed files with 8 additions and 4 deletions
|
|
@ -1185,10 +1185,6 @@ when defined(nimdoc):
|
||||||
##
|
##
|
||||||
## Before stopping the program the "exit procedures" are called in the
|
## Before stopping the program the "exit procedures" are called in the
|
||||||
## opposite order they were added with `addExitProc <exitprocs.html#addExitProc,proc)>`_.
|
## 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
|
## The proc `quit(QuitSuccess)` is called implicitly when your nim
|
||||||
## program finishes without incident for platforms where this is the
|
## 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
|
## 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
|
## macro, use the `error <manual.html#pragmas-error-pragma>`_ or `fatal
|
||||||
## <manual.html#pragmas-fatal-pragma>`_ pragmas.
|
## <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):
|
elif defined(genode):
|
||||||
include genode/env
|
include genode/env
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue