Is anybody using the named boolean operators?

前端 未结 13 2255
南方客
南方客 2020-12-06 10:52

Or are we all sticking to our taught \"&&, ||, !\" way?

Any thoughts in why we should use one or the other?

I\'m just wondering because several answe

13条回答
  •  悲&欢浪女
    2020-12-06 11:36

    Although I've been programming C++ from quite some time, I did not know that the keywords "and" "or" and "not" were allowed, and I've never seen it used.

    I searched through my C++ book, and I found a small section mentioning alternative representation for the normal operators "&&", "||" and "!", where it explains those are available for people with non-standard keyboards that do not have the "&!|" symbols.

    A bit like trigraphs in C.

    Basically, I would be confused by their use, and I think I would not be the only one. Using a representation which is non-standard, should really have a good reason to be used. And if used, it should be used consistently in the code, and described in the coding standard.

提交回复
热议问题