为什么连字符选为C ++中引用的符号? [英] Why was the ampersand chosen as the symbol for references in C++?

查看:161
本文介绍了为什么连字符选为C ++中引用的符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有,为什么符号被选为表示用C ++引用的方式的想法?

Does anyone have an idea why the ampersand was chosen as the way to denote references in C++?

据我所知(尽管我没有这本书在我身边),Stroustroup没有解释这样的选择,我觉得有些奇怪,因为相同的符号已经被用在C地址的。

AFAIK (though I don't have the book near me), Stroustroup didn't explain that choice, which I find a little odd because the same symbol was already used for address-of in C.

推荐答案

斯特劳斯总是很不愿意引入新的保留符号或名称,所以他很可能用它来避免使功能看起来很怪异到C的用户。

Stroustrup was always very reluctant to introduce a new reserved symbol or name, so he probably used it to avoid making the feature look weird to users of C.

这篇关于为什么连字符选为C ++中引用的符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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