Pragmatic directives: Difference between revisions
Content deleted Content added
m →{{header|Phix}}: updated for 1.0.2 |
→{{header|Lua}}: added Lua solution |
||
Line 347: | Line 347: | ||
val s = "To be suppressed" |
val s = "To be suppressed" |
||
}</lang> |
}</lang> |
||
=={{header|Lua}}== |
|||
Lua itself really doesn't have anything equivalent. However, if being used in a mixed/hosted/embedded environment, the <code>ffi</code> library might be encountered, which supports <code>pragma pack</code> to facilitate native type interchange: |
|||
<lang lua>ffi = require("ffi") |
|||
ffi.cdef[[ |
|||
#pragma pack(1) |
|||
typedef struct { char c; int i; } foo; |
|||
#pragma pack(4) |
|||
typedef struct { char c; int i; } bar; |
|||
]] |
|||
print(ffi.sizeof(ffi.new("foo"))) |
|||
print(ffi.sizeof(ffi.new("bar")))</lang> |
|||
{{out}} |
|||
<pre>5 |
|||
8</pre> |
|||
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
=={{header|Mathematica}}/{{header|Wolfram Language}}== |