From c6c836692585b6a94f7c453bf1dff82be0107b2f Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Thu, 12 Dec 2013 00:57:31 +0100 Subject: [PATCH 1/2] Mentions static alternatives to quit(). --- lib/system.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/system.nim b/lib/system.nim index dc5a406d14..d7a9b08ab1 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -923,6 +923,10 @@ proc quit*(errorcode: int = QuitSuccess) {. ## The proc ``quit(QuitSuccess)`` is called implicitly when your nimrod ## program finishes without incident. A raised unhandled exception is ## equivalent to calling ``quit(QuitFailure)``. + ## + ## Note that this is a *runtime* call and using ``quit`` inside a macro won't + ## have any compile time effect. If you need to stop the compiler inside a + ## macro, use the ``error`` or ``fatal`` pragmas. template sysAssert(cond: bool, msg: string) = when defined(useSysAssert): From b4d6a6aafe400556d3557cb7ccf0a12a40e1b4e7 Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Thu, 12 Dec 2013 01:00:23 +0100 Subject: [PATCH 2/2] Adds example to fatal pragma. --- doc/manual.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/manual.txt b/doc/manual.txt index dabff3d69d..ee283da0c0 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -4708,7 +4708,11 @@ fatal pragma ------------ The `fatal`:idx: pragma is used to make the compiler output an error message with the given content. In contrast to the ``error`` pragma, compilation -is guaranteed to be aborted by this pragma. +is guaranteed to be aborted by this pragma. Example: + +.. code-block:: nimrod + when not defined(objc): + {.fatal: "Compile this program with the objc command!".} warning pragma --------------