struct中变量名前面的点是什么意思? [英] What does a dot before the variable name in struct mean?

查看:130
本文介绍了struct中变量名前面的点是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看Linux内核源代码,我发现了这一点:

looking at the linux kernel source, I found this:

static struct tty_operations serial_ops = {
  .open = tiny_open,
  .close = tiny_close,
  .write = tiny_write,
  .write_room = tiny_write_room,
  .set_termios = tiny_set_termios,
};

我从未在C语言中看到过这样的表示法. 为什么变量名前面有一个点?

I've never seen such a notation in C. Why is there a dot before the variable name?

推荐答案

这是指定的初始化程序,这是为C99添加的语法.

This is a Designated Initializer, which is syntax added for C99.

这篇关于struct中变量名前面的点是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆