summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-11-15 20:24:14 +0100
committerGitHub <noreply@github.com>2019-11-15 20:24:14 +0100
commit58f3e07b1a84b2cbe1c1fab690b8dd6b9ed5a296 (patch)
treeef7096e37cb19c340c4bdeb04b4ae2e6bb5ec1d2 /doc
parent9c46526cfa928f884b06ea78f3f7304bdc626ed1 (diff)
downloadNim-58f3e07b1a84b2cbe1c1fab690b8dd6b9ed5a296.tar.gz
fixes and changes the recently introduced 'alignas' to be 'align' (#12666)
* fixes and changes the recently introduced 'alignas' to be 'align'

* more improvements
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.rst27
1 files changed, 14 insertions, 13 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index 71bfb1e2b..c869b391f 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -6433,38 +6433,39 @@ generates:
     unsigned int flag:1;
   };
 
-Alignas pragma
---------------
 
-The ``alignas`` pragma is for variables and object field members. It
-modifies the alignment requirement of the thing being declared. The
-argument must be a constant power of 2 or 0.  Valid non-zero
-alignments that are weaker than another alignas pragmas on the same
-declaration are ignored.  Alignments that are weaker that the
-alignment requirement of the type are ignored. ``alignas(0)`` is
-always ignored.
+Align pragma
+------------
+
+The `align`:idx: pragma is for variables and object field members. It
+modifies the alignment requirement of the entity being declared. The
+argument must be a constant power of 2. Valid non-zero
+alignments that are weaker than nother align pragmas on the same
+declaration are ignored. Alignments that are weaker that the
+alignment requirement of the type are ignored.
 
 .. code-block:: Nim
 
    type
      sseType = object
-       sseData {.alignas(16).}: array[4,float32]
+       sseData {.align(16).}: array[4,float32]
 
      # every object will be aligned to 128-byte boundary
      Data = object
        x: char
-       cacheline {.alignas(128).}: array[128, char] # over-aligned array of char,
+       cacheline {.align(128).}: array[128, char] # over-aligned array of char,
 
    proc main() =
      echo "sizeof(Data) = ", sizeof(Data), " (1 byte + 127 bytes padding + 128-byte array)"
      # output: sizeof(Data) = 256 (1 byte + 127 bytes padding + 128-byte array)
      echo "alignment of sseType is ", alignof(sseType)
      # output: alignment of sseType is 16
-     var d {.alignas(2048).}: Data # this instance of data is aligned even stricter
+     var d {.align(2048).}: Data # this instance of data is aligned even stricter
 
    main()
 
-This pragma has no effect on nimvm or the js backend.
+This pragma has no effect for the JS backend.
+
 
 Volatile pragma
 ---------------