diff options
author | Mike Pall <mike> | 2012-08-27 20:52:15 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-08-27 20:53:37 +0200 |
commit | c7826af5a0403b48eeeb6c18532dc076146b1966 (patch) | |
tree | b5f1e86268e3e4ab49d3bb4c8044a9efd61d322f /doc | |
parent | 76b18b2b465532e528af2162e79365794c8ba290 (diff) | |
download | luajit-c7826af5a0403b48eeeb6c18532dc076146b1966.tar.gz luajit-c7826af5a0403b48eeeb6c18532dc076146b1966.tar.bz2 luajit-c7826af5a0403b48eeeb6c18532dc076146b1966.zip |
FFI: Detect type punning through unions.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ext_ffi_semantics.html | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index afe7e613..56b3f62e 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html | |||
@@ -192,8 +192,8 @@ a <tt>typedef</tt>, except re-declarations will be ignored): | |||
192 | 192 | ||
193 | </ul> | 193 | </ul> |
194 | <p> | 194 | <p> |
195 | You're encouraged to use these types in preference to the | 195 | You're encouraged to use these types in preference to |
196 | compiler-specific extensions or the target-dependent standard types. | 196 | compiler-specific extensions or target-dependent standard types. |
197 | E.g. <tt>char</tt> differs in signedness and <tt>long</tt> differs in | 197 | E.g. <tt>char</tt> differs in signedness and <tt>long</tt> differs in |
198 | size, depending on the target architecture and platform ABI. | 198 | size, depending on the target architecture and platform ABI. |
199 | </p> | 199 | </p> |
@@ -660,12 +660,18 @@ initialization. The JIT compiler benefits from this fact when applying | |||
660 | certain optimizations. | 660 | certain optimizations. |
661 | </p> | 661 | </p> |
662 | <p> | 662 | <p> |
663 | As a consequence of this, the <em>elements</em> of complex numbers and | 663 | As a consequence, the <em>elements</em> of complex numbers and |
664 | vectors are immutable. But the elements of an aggregate holding these | 664 | vectors are immutable. But the elements of an aggregate holding these |
665 | types <em>may</em> be modified of course. I.e. you cannot assign to | 665 | types <em>may</em> be modified of course. I.e. you cannot assign to |
666 | <tt>foo.c.im</tt>, but you can assign a (newly created) complex number | 666 | <tt>foo.c.im</tt>, but you can assign a (newly created) complex number |
667 | to <tt>foo.c</tt>. | 667 | to <tt>foo.c</tt>. |
668 | </p> | 668 | </p> |
669 | <p> | ||
670 | The JIT compiler implements strict aliasing rules: accesses to different | ||
671 | types do <b>not</b> alias, except for differences in signedness (this | ||
672 | applies even to <tt>char</tt> pointers, unlike C99). Type punning | ||
673 | through unions is explicitly detected and allowed. | ||
674 | </p> | ||
669 | 675 | ||
670 | <h3 id="cdata_call">Calling a cdata object</h3> | 676 | <h3 id="cdata_call">Calling a cdata object</h3> |
671 | <ul> | 677 | <ul> |