什么是C 22!??!运营商呢? [英] What does the C ??!??! operator do?

查看:116
本文介绍了什么是C 22!??!运营商呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了一个C线的,看上去是这样的:

I saw a line of C that looked like this:

!ErrorHasOccured() ??!??! HandleError();

它正确编译,似乎运行正常。它好像它检查是否已发生了错误,并且,如果它有,它处理它。但我真的不知道什么它实际上做或它是如何做的。它看起来就像程序员试图EX preSS有关错误自己的感受。

It compiled correctly and seems to run ok. It seems like it's checking if an error has occurred, and if it has, it handles it. But I'm not really sure what it's actually doing or how it's doing it. It does look like the programmer is trying express their feelings about errors.

我从来没有见过的 ??!??!之前任何编程语言,而我不能为它的任何地方找到文档。 (谷歌并不像搜索字词帮助??!??!)。这是什么做的,怎么做的code样品的工作?

I have never seen the ??!??! before in any programming language, and I can't find documentation for it anywhere. (Google doesn't help with search terms like ??!??!). What does it do and how does the code sample work?

推荐答案

?? <!/ code>是的三字母可以转换为 | 。因此,它说:

??! is a trigraph that translates to |. So it says:

!ErrorHasOccured() || HandleError();

其中,由于短路,相当于:

which, due to short circuiting, is equivalent to:

if (ErrorHasOccured())
    HandleError();

的周,在那里我拿起这件事(与C ++,但与此有关的交易)大师。

Guru of the Week (deals with C++ but relevant here), where I picked this up.

可能起源或为@ DWB中,由于EBCDIC暂时难以(再次)它更可能的评论指出。 在IBM developerWorks董事会讨论似乎支持这一理论。

Possible origin of trigraphs or as @DwB points out in the comments it's more likely due to EBCDIC being difficult (again). This discussion on the IBM developerworks board seems to support that theory.

从ISO / IEC 9899:1999§5.2.1.1,脚注12(H / T @ Random832):

From ISO/IEC 9899:1999 §5.2.1.1, footnote 12 (h/t @Random832):

的字母序列使未在不变code设置为定义的字符的输入
  在ISO / IEC 646,这是七位US ASCII code组的一个子集描述。

The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.

这篇关于什么是C 22!??!运营商呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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