Memory layout of a data structure: Difference between revisions

Added FreeBASIC
(Added FreeBASIC)
Line 294:
 
In a similar way, text content may employ only a limited character set so perhaps five bits per symbol would suffice, or some other packing scheme might suggest itself. There is also a whole world of compression algorithms. The end result is that a data structure manifesting as records in a disc file may be difficult to unpack into a convenient internal form even given a careful description of the layout.
 
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
 
' using bit fields
Type RS232_Pin9
carrierDetect : 1 As UByte
receivedData : 1 As UByte
transmittedData : 1 As UByte
dataTerminalReady : 1 As UByte
signalGround : 1 As UByte
dataSetReady : 1 As UByte
requestToSend : 1 As UByte
clearToSend : 1 As UByte
ringIndicator : 1 As UByte
End Type
 
Print SizeOf(RS232_Pin9) '' 2 bytes
Sleep</lang>
 
=={{header|Go}}==
9,479

edits