C ++代码中“??? - `的含义 [英] meaning of `???-` in C++ code

查看:1724
本文介绍了C ++代码中“??? - `的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到以下代码来自一些旧代码:

I saw the following code from some legacy codes:

 size_t a = 1 ???- 2 :0;

符号? - 是什么意思在C ++?我应该怎么理解?

What does the symbol ???- mean in C++? How should I understand it?

谢谢!

推荐答案

实际上:

size_t a = 1 ? ~2 :0;

?? - =http://en.wikipedia.org/wiki/Digraphs_and_trigraphs>三角图

??- is a trigraph for ~

Trigraphs来自一个古老的时代......在我们的一些人甚至出生之前。

Trigraphs are from an old era... before some of us were even born.

有一些字符并不总是被支持。一个不知情的程序员会尝试输入这样的字符,只是发现它不存在于键盘上!

Back in the days, there were some characters that weren't always supported. An unknowing programmer would try to type in such a character only to find that it doesn't exist on the keyboard!


图片来源:http://www.myoldmac.net/cgi-data/forum/phpBB2/viewtopic.php?t=305

因此添加了三字母以允许程序员在这些字符不存在时(在编码或从键盘)访问这些字符的功能。

So trigraphs were added to allow the programmer to access the functionality of these characters when they didn't exist (either in the encoding or from the keyboard).

现在,它们已经过时了,在混淆读者方面比在解决旧标准方面更有效。

Nowadays, they are obsolete and are more effective in confusing the reader than in getting around old standards.

所以代码太旧了,作者是一个混蛋。

So either that code is really old, or the author was being a jerk.

这篇关于C ++代码中“??? - `的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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