什么时候“和”和“或”替代令牌在C ++中引入? [英] When were the 'and' and 'or' alternative tokens introduced in C++?

查看:135
本文介绍了什么时候“和”和“或”替代令牌在C ++中引入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚从Reddit阅读了这篇漂亮的作品

I've just read this nice piece from Reddit.

他们提到为替代令牌 $ c>&& 和 ||

They mention and and or being "Alternative Tokens" to && and ||

我真的不知道这些直到现在。当然,每个人都知道双图和三图,但?从何时起?这是最近添加的标准吗?

I was really unaware of these until now. Of course, everybody knows about the di-graphs and tri-graphs, but and and or? Since when? Is this a recent addition to the standard?

我刚刚用Visual C ++ 2008检查它,它似乎不认识这些除了语法错误。发生了什么事?

I've just checked it with Visual C++ 2008 and it doesn't seem to recognize these as anything other than a syntax error. What's going on?

推荐答案

MSVC仅在使用 / Za 选项禁用扩展;这至少从VC7.1(VS2003)是真的。

MSVC supports them as keywords only if you use the /Za option to disable extensions; this is true from at least VC7.1 (VS2003).

您可以通过包含 iso646.h 来获得支持的宏。

You can get them supported as macros by including iso646.h.

我的猜测是他们认为,默认情况下,他们的关键字会打破太多的现有代码(如果他们是正确的,我不会感到惊讶)。

My guess is they believe that making them keywords by default would break too much existing code (and I wouldn't be surprised if they are right).

这几个星期前在某个问题上讨论过这个问题,但是我不能让SO的搜索或Google找到这个东西。

This was discussed in a question a couple weeks ago somewhere here on SO, but I can't get SO's search or Google to find the damn thing.

这篇关于什么时候“和”和“或”替代令牌在C ++中引入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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