GNU C标记化结构初始化语法.docVIP

  • 6
  • 0
  • 约6.96万字
  • 约 8页
  • 2016-12-23 发布于贵州
  • 举报
GNU C标记化结构初始化语法---结构体成员前加小数点 对结构体 [cpp]?view plaincopyprint? struct?a { int?b; int?c; } 有几种初始化方式: [cpp]?view plaincopyprint? struct?a a1 = { .b = 1, .c = 2 }; 或者 [cpp]?view plaincopyprint? struct?a a1 = { b:1, c:2 } 或者 [cpp]?view plaincopyprint? struct?a a1 = {1, 2}; 内核喜欢用第一种,使用第一种和第二种时,成员初始化顺序可变。 标记化结构初始化语法 在Linux2.6内核中对结构体的定义形式发生了变化,不再支持原来的定义形式。 [cpp]?view plaincopyprint? 1?static?struct?tty_operations uart_ops = 2 { 3 .open = uart_open,//串口打开 4 .close = uart_close,//串口关闭 5 .write = uart_write,//串口发送 6 .put_char = uart_put_char,//... 7 .flush_chars = uart_flush_chars, 8 .write_room

文档评论(0)

1亿VIP精品文档

相关文档