document new bitsize pragma

This commit is contained in:
Aman Gupta
2015-09-30 12:29:32 -07:00
parent 87ab263d52
commit 8c86467730
2 changed files with 20 additions and 0 deletions

View File

@@ -531,6 +531,24 @@ Implementation Specific Pragmas
This section describes additional pragmas that the current Nim implementation
supports but which should not be seen as part of the language specification.
Bitsize pragma
--------------
The ``bitsize`` pragma is for object field members. It declares the field as
a bitfield in C/C++.
.. code-block:: Nim
type
mybitfield = object
flag {.bitsize:1.}: cuint
generates:
.. code-block:: C
struct mybitfield {
unsigned int flag:1;
};
Volatile pragma
---------------

View File

@@ -108,6 +108,8 @@ News
- The compiler finally considers symbol binding rules in templates and
generics for overloaded ``[]``, ``[]=``, ``{}``, ``{}=`` operators
(issue `#2599 <https://github.com/nim-lang/Nim/issues/2599>`_).
- The compiler now supports a `bitsize pragma <docs/manual.html#pragmas-bitsize-pragma>`_
for constructing bitfields.
Language Additions