Jump to content

Memory layout of a data structure: Difference between revisions

→‎{{header|Go}}: Make the constants type safe
(Add Nimrod)
(→‎{{header|Go}}: Make the constants type safe)
Line 269:
 
const (
CD9 CD9 rs232p9 = 1 << iota // Carrier detect
RD9 RD9 // Received data
TD9 TD9 // Transmitted data
DTR9 DTR9 // Data terminal ready
SG9 SG9 // signal ground
DSR9 DSR9 // Data set ready
RTS9 RTS9 // Request to send
CTS9 CTS9 // Clear to send
RI9 RI9 // Ring indicator
)
 
func main() {
// set some nonsense bits just for example
var p rs232p9 := RI9 | TD9 | CD9
fmt.Printf("Type=%T value=%#04x\n", p, p)
}</lang>
{{out}}
Output:
<pre>
Type=main.rs232p9 value=0x0105
0105
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.