mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-25 08:43:58 +00:00
document new bitsize pragma
This commit is contained in:
@@ -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
|
||||
---------------
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user