sizeof的优先级

编程入门 行业动态 更新时间:2024-10-24 16:30:21
本文介绍了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写道: On Oct 6, 9:39 pm, Frederick Gotham <fgotha...@SPAMwrote: 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写道: On Oct 6, 9:39 pm, Frederick Gotham <fgotha...@SPAMwrote: 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的优先级

本文发布于:2023-10-30 11:41:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542748.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:优先级   sizeof

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!