首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

哪位高手能解释一下这个初始化语句?STARTUPINFO si = {sizeof(si)}

2012-02-15 
谁能解释一下这个初始化语句?STARTUPINFO si {sizeof(si)}我在《windows核心编程》看到这个初始化语句,那

谁能解释一下这个初始化语句?STARTUPINFO si = {sizeof(si)};
我在《windows核心编程》看到这个初始化语句,那位能给我解释一下?      
    它的运行结果和      
    si.cb       =       sizeof(si);      
    si.reserved       =       0;      
    si.reserved2       =       0;      
    ……      
    是一样的,不过后者要把所有的成员都初始化为0才行。

[解决办法]
数组怎么初始化的规则知道吧。
[解决办法]
结构使用{}来初始化结构内的成员,缺省为0

[解决办法]
这是C++标准规定的... 对于aggregate的初始化:

If there are fewer initializers in the list than there are members in the aggregate, then each member not explicitly
initialized shall be value-initialized (8.5). [ Example:
struct S { int a; char* b; int c; };
S ss = { 1, "asdf " };
initializes ss.a with 1, ss.b with "asdf ", and ss.c with the value of an expression of the form int(), that is, 0.
—end example ]

[解决办法]

热点排行