sizeof的优先级 [英] Precedence of sizeof
问题描述
sizeof与演员阵容具有相同的优先级,并且他们都从右边绑定到
左边。以下不能用gcc为我编译:
int main(无效)
{
sizeof(double) 5;
返回0;
}
它是否与globbing有关?
-
Frederick Gotham
sizeof has the same precedence as a cast, and they both bind from right to
left. The following won''t compile for me with gcc:
int main(void)
{
sizeof(double)5;
return 0;
}
Has it got something to do with "globbing"?
--
Frederick Gotham
推荐答案
10月6日晚9点39分,Frederick Gotham< fgotha ... @ SPAM.com写道:
On Oct 6, 9:39 pm, Frederick Gotham <fgotha...@SPAM.comwrote:
sizeof具有与演员相同的优先级,并且它们都从右边绑定到
左边。以下不能用gcc为我编译:
int main(无效)
{
sizeof(double) 5;
返回0;
}
它是否与globbing有关?
-
Frederick Gotham
sizeof has the same precedence as a cast, and they both bind from right to
left. The following won''t compile for me with gcc:
int main(void)
{
sizeof(double)5;
return 0;
}
Has it got something to do with "globbing"?
--
Frederick Gotham
" sizeof((double )5)"效果很好。
"sizeof ((double)5)" works well.
Cong Wang写道:
Cong Wang wrote:
10月6日晚9点39分,Frederick Gotham< fgotha ... @ SPAM.com写道:
On Oct 6, 9:39 pm, Frederick Gotham <fgotha...@SPAM.comwrote:
sizeof与演员阵容具有相同的优先级,他们俩都是从右边绑定到
离开。以下不能用gcc为我编译:
int main(无效)
{
sizeof(double) 5;
返回0;
}
它是否与globbing有关?
-
Frederick Gotham
sizeof has the same precedence as a cast, and they both bind from right to
left. The following won''t compile for me with gcc:
int main(void)
{
sizeof(double)5;
return 0;
}
Has it got something to do with "globbing"?
--
Frederick Gotham
" sizeof((double )5)"效果很好。
"sizeof ((double)5)" works well.
Cong Wang发布:
Cong Wang posted:
" sizeof((double)5)"效果很好。
"sizeof ((double)5)" works well.
是的,我意识到了。我的问题涉及运算符优先级和
关联性 - 具体来说,原因:
sizeof(double)5
被gcc解释为:
(sizeof(double))5
而不是:
sizeof((double)5)
-
Frederick Gotham
Yes, I realise that. My question pertains to operator precedence and
associativity -- specifically, why:
sizeof(double)5
is interpretted by gcc as:
(sizeof(double))5
rather than:
sizeof((double)5)
--
Frederick Gotham
这篇关于sizeof的优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!