"怪异"变量初始化

时间:2016-12-21 21:16:21

标签: c++ variables initialization

是什么意思:

GLuint bindingPoint = 1, buffer, blockIndex;

我在一个需要的教程中找到了这个,我以前从未见过这样的变量初始化。

这一行是否意味着

GLuint bindingPoint = 1;
GLuint bindingPoint = buffer;
GLuint bindingPoint = blockIndex;

1 个答案:

答案 0 :(得分:7)

GLuint bindingPoint = 1, buffer, blockIndex;行等同于以下三行:

GLuint bindingPoint = 1;
GLuint buffer;
GLuint blockIndex;

两个版本都定义了变量bindingPoint, buffer, blockIndex。将bindingPoint初始化为1