C++ Logo


Advanced search

Re: [std-proposals] ^^operator [was: Re: New draft proposal: Add "%s" (two-digit truncated-integer seconds) as a std::format conversion specifier for std::chrono time types.]

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 4 May 2023 09:42:15 +0200
However, your other listed benefits (except consistency) are still valid: > (Other benefits of ^^ are not requiring explicit casts like "bool(x) ^ bool(y)" (vs "x ^^ y"), and fewer bugs where coders accidentally bitwise compare instead of boolean. But people learn that a single logical operator is bitwise, and a double logical operator is boolean. They then have to remember that ^ doesn't have a bitwise equivalent. ^ is already bitwise. You mean ^ has no logical equivalent? Some logical operators use doubled symbols, some not. && and || specifically stand for the short-circuit evaluation. Otherwise for consistency one would want to introduce !! instead of ! for logical NOT, which would lead to a lot of confusion and faulty programs.

Received on 2023-05-04 07:42:17