Memory layout of a data structure: Difference between revisions

m
m (-Java)
Line 62:
end record;</lang>
=={{header|ALGOL 68}}==
{{works with|ALGOL 68|StandardRevision 1 - no extensions to language used}}
{{workswont work with|ALGOL 68G|Any - tested with release [https://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.15-0.8b/algol68g-mk15-0.8b.fc9.i386.rpm/download algol68g-1.15-0.8b] - bug is order of BITS}}
<!-- {{not works with|ELLA ALGOL 6868G|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.818.8d0/algol68g-1.18.0-9h.tiny.el5.centos.fc9fc11.i386}}.rpm/download 1.18.0-->9h.tiny]}}
 
<!-- n.b. there is a discrepancy between ALGOL 68G and ELLA ALGOL 68,
{{works with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d]}}
I am checking the RR to see which is the correct output -->
<lang algol68><lang algol68>MODE RSTWOTHREETWO = BITS;
INT ofs = bits width - 9;
INT
lwb rs232 = ofs + 1,
carrier detect = ofs + 1,
received data = ofs + 2,
transmitted data = ofs + 3,
data terminal ready = ofs + 4,
signal ground = ofs + 5,
data set ready = ofs + 6,
request to send = ofs + 7,
clear to send = ofs + 8,
ring indicator = ofs + 9,
upb rs232 = ofs + 9;
RSTWOTHREETWO rs232 bits := 2r010000000000000000000000000000002r10000000; # up to bits width, OR #
print(("received data: ",received data ELEM rs232bits, new line))</lang>;
rs232 bits := bits pack((FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE));
 
rs232 bits := bits pack((FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE));
print(("received data: ",received data ELEM rs232bits))</lang>
print(("received data: ",received data ELEM rs232bits, new line))</lang>
Output:
<pre>
<lang algol68>received data: T</lang>
received data: T
</pre>
 
=={{header|C}}/{{header|C++}}==