为什么运营商在CShell右结合的是左关联的用C? [英] Why are operators right associative in CShell that are left associative in C?

查看:114
本文介绍了为什么运营商在CShell右结合的是左关联的用C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的previous问题 ,为什么CShell从C如此不同?

Following up from my previous question, why is CShell so different from C?


  • 4 - 3 + 1 = 2用C

  • 4 - 3 + 1 CShell = 0

任何想法?

推荐答案

一般传统的符号是留给人类的论文右(左结合)。因此,对于人类(它使用这个符号长在C之前,csh或电脑甚至没有任何概念):

Generally the traditional notation is left to right (left associative) in human papers. So for humans (which used this notation long before c, csh or even any notion of computers):

4 - 3 + 1 = (4 - 3) + 1 = 1 + 1 = 2

为什么呢?我想,最好的回答是,因为。这是相同的,与驾驶道路的左边或右边。这其实并不重要哪一方,只要每个人都使用相同的。

Why? I guess that the best answer is because. It's the same as with driving left or right side of road. It really doesn't matter which side as long as everyone uses the same.

恕我直言,长山壕是错误的,因为它是反直觉。也许这是一个错误(他们想离开联想,但错误codeD),并成为遗产作为其他的事情已经depeneded这一点。

IMHO the csh is wrong as it is counter-intuitive. Possibly it was an error (they wanted left associative but coded wrongly) and become legacy as other things already depeneded on this.

这篇关于为什么运营商在CShell右结合的是左关联的用C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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