Memory layout of a data structure: Difference between revisions
Content added Content deleted
(Point to C++ instead of C plus plus) |
m (Switch to header template) |
||
Line 37: | Line 37: | ||
25 - |
25 - |
||
== |
=={{header|Ada}}== |
||
[[Category:Ada]] |
[[Category:Ada]] |
||
type Bit is mod 2; |
type Bit is mod 2; |
||
Line 64: | Line 64: | ||
end record; |
end record; |
||
== |
=={{header|C}}/{{header|C++}}== |
||
[[Category:C]] |
[[Category:C]] |
||
[[Category:C++]] |
[[Category:C++]] |
||
Line 82: | Line 82: | ||
The ":1" gives the number of allocated bits. For unused bits (e.g. pin 11 in the 25-pin version above) the field name can be omitted. |
The ":1" gives the number of allocated bits. For unused bits (e.g. pin 11 in the 25-pin version above) the field name can be omitted. |
||
== |
=={{header|Forth}}== |
||
[[Category:Forth]] |
|||
Low level hardware control is a typical use of Forth. None of this is standard, however, since hardware I/O mechanisms differ on different systems. Forth does not have a structure mechanism, much less bitfields. These would be represented instead via bitmask constants if doing real serial port control. |
Low level hardware control is a typical use of Forth. None of this is standard, however, since hardware I/O mechanisms differ on different systems. Forth does not have a structure mechanism, much less bitfields. These would be represented instead via bitmask constants if doing real serial port control. |
||
Line 119: | Line 118: | ||
Of course, this is a very simplified view of the full RS-232 protocol. Also, although this represents the order of the pins in a D-9 connector, this would not necessarily be the same as the order of the bits in a control register. |
Of course, this is a very simplified view of the full RS-232 protocol. Also, although this represents the order of the pins in a D-9 connector, this would not necessarily be the same as the order of the bits in a control register. |
||
== |
=={{header|Perl}}== |
||
[[Category:Perl]] |
|||
use Bit::Vector::Minimal qw(); |
use Bit::Vector::Minimal qw(); |
||
my $vec = Bit::Vector::Minimal->new(size => 24); |
my $vec = Bit::Vector::Minimal->new(size => 24); |