变化为何具有较低的precedence比加减用C? [英] Why do shifts have lower precedence than addition and subtraction in C?

查看:117
本文介绍了变化为何具有较低的precedence比加减用C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做位操作时(虽然我不记得介意任何具体的例子现在)有时会觉得这很不方便。我也觉得混淆概念,因为变化基本上是乘法和除法由两个大国。

I sometimes find this inconvenient when doing bit manipulation (though I can't recall to mind any specific examples right now). I also find it conceptually confusing, since shifts are basically multiplication and division by powers of two.

我看到,它可以用C ++方便使用&LT时;<将输出发送到一个ostream,但当然不能用来解释顺序最初是如何固定在C

I see that it can be convenient in C++, when using << to send output to an ostream, but of course that can't be used to explain how the order was originally fixed in C.

推荐答案

由于这正是C语言的作者决定。

Because that's what the authors of the C language decided.

使用括号以避免混淆。

这篇关于变化为何具有较低的precedence比加减用C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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