Update documentation and news

This commit is contained in:
Jeff Ciesielski 2016-07-05 09:06:40 -04:00
commit 11730e6c3b
4 changed files with 44 additions and 2 deletions

View file

@ -1011,3 +1011,30 @@ debugging:
# ... complex code here that produces crashes ...
compile time define pragmas
---------------------------
The pragmas listed here can be used to optionally accept values from
the -d/--define option at compile time.
The implementation currently provides the following possible options (various
others may be added later).
=============== ============================================
pragma description
=============== ============================================
intdefine Reads in a build-time define as an integer
strdefine Reads in a build-time define as a string
=============== ============================================
.. code-block:: nim
const FooBar {.intdefine.}: int = 5
echo FooBar
.. code-block:: bash
nim c -d:FooBar=42 foobar.c
In the above example, providing the -d flag causes the symbol
``FooBar`` to be overwritten at compile time, printing out 42. If the
``-d:FooBar=42`` were to be omitted, the default value of 5 would be
used.