Anonymous user
Memory layout of a data structure: Difference between revisions
Memory layout of a data structure (view source)
Revision as of 18:00, 28 February 2012
, 12 years agoFixed second D entry
(→{{header|Pascal}}: add example) |
(Fixed second D entry) |
||
Line 112:
=={{header|D}}==
===Tango version===
Implementation uses tango's BitArray structure.
{{libheader|tango}}
Line 190 ⟶ 191:
[RD:0, RI:1, DSR:1, SG:1, DTR:1, TC:1, TD:1, CD:1, SQD:1, +:1, -:1, SRD:1, RTS:1, SRS:1, STD:1, PG:1, SCD:1, CTS:0, DRS:1, SCS:1, XTC:1, RC:1 ]
</pre>
===Phobos version===
Not tested.
<lang d>import std.bitmanip;
struct RS232_data {
static if (std.system.endian == std.system.Endian.
mixin(bitfields!(bool, "carrier_detect", 1,
bool, "received_data", 1,
Line 217 ⟶ 219:
bool, "carrier_detect", 1));
}
static assert(RS232_data.sizeof == 2);
}
void main() {}</lang>
=={{header|Forth}}==
|