|
2 | 2 | <html>
|
3 | 3 | <head>
|
4 | 4 | <title>FFI Semantics</title>
|
5 |
| -<meta charset="utf-8"> |
6 |
| -<meta name="Copyright" content="Copyright (C) 2005-2022"> |
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 6 | +<meta name="Copyright" content="Copyright (C) 2005-2023"> |
7 | 7 | <meta name="Language" content="en">
|
8 | 8 | <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
|
9 | 9 | <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
|
@@ -49,9 +49,9 @@ <h1>FFI Semantics</h1>
|
49 | 49 | <a href="ext_c_api.html">Lua/C API</a>
|
50 | 50 | </li></ul>
|
51 | 51 | </li><li>
|
52 |
| -<a href="status.html">Status</a> |
| 52 | +<a href="https://luajit.org/status.html">Status <span class="ext">»</span></a> |
53 | 53 | </li><li>
|
54 |
| -<a href="faq.html">FAQ</a> |
| 54 | +<a href="https://luajit.org/faq.html">FAQ <span class="ext">»</span></a> |
55 | 55 | </li><li>
|
56 | 56 | <a href="https://luajit.org/list.html">Mailing List <span class="ext">»</span></a>
|
57 | 57 | </li></ul>
|
@@ -438,6 +438,19 @@ <h3 id="convert_vararg">Conversions for vararg C function arguments</h3>
|
438 | 438 | conversion rule applies. A vararg C function expecting an integer
|
439 | 439 | will see a garbled or uninitialized value.
|
440 | 440 | </p>
|
| 441 | +<p> |
| 442 | +Note: this is the only place where creating a boxed scalar number type is |
| 443 | +actually useful. <b>Never use <tt>ffi.new("int")</tt>, <tt>ffi.new("float")</tt> |
| 444 | +etc. anywhere else!</b> |
| 445 | +</p> |
| 446 | +<p style="font-size: 8pt;"> |
| 447 | +Ditto for <tt>ffi.cast()</tt>. Explicitly boxing scalars <b>does not</b> |
| 448 | +improve performance or force <tt>int</tt> or <tt>float</tt> arithmetic! It |
| 449 | +just adds costly boxing, unboxing and conversions steps. And it may lead |
| 450 | +to surprise results, because |
| 451 | +<a href="#cdata_arith">cdata arithmetic on scalar numbers</a> |
| 452 | +is always performed on 64 bit integers. |
| 453 | +</p> |
441 | 454 |
|
442 | 455 | <h2 id="init">Initializers</h2>
|
443 | 456 | <p>
|
@@ -1243,7 +1256,7 @@ <h2 id="status">Current Status</h2>
|
1243 | 1256 | </div>
|
1244 | 1257 | <div id="foot">
|
1245 | 1258 | <hr class="hide">
|
1246 |
| -Copyright © 2005-2022 |
| 1259 | +Copyright © 2005-2023 |
1247 | 1260 | <span class="noprint">
|
1248 | 1261 | ·
|
1249 | 1262 | <a href="contact.html">Contact</a>
|
|
0 commit comments