sometimes I would like to do
bool success= true;
success &&= dosmthing1();
success &&= dosmthing2();
success &&= dosmthing3();
if (success)
Lets ignore that I could be using exceptions...
my question is is it guaranteed by C++ standard that &=
will behave like nonexisting &&=
for my use case?
...
EDIT: do smthing-s return bool
Is is what is known as a state of being verb. State of being verbs do not express any specific activity or action but instead describe existence. The most common state of being verb is to be, along with its conjugations (is, am, are, was, were, being, been).
present tense third-person singular of be.
In mathematics, −1 (also known as negative one or minus one) is the additive inverse of 1, that is, the number that when added to 1 gives the additive identity element, 0. It is the negative integer greater than negative two (−2) and less than 0.
Or is a conjunction that connects two or more possibilities or alternatives. It connects words, phrases and clauses which are the same grammatical type: Which do you prefer? Leather or suede? You can have some freshly baked scones or some chocolate cake or both.
That depends on how you expect &&=
to work. If you want x &&= y();
to be equivalent to x = x && y();
, then no, because in this expression y()
is not called if x
starts out as false, but in x &= y();
it will be.
If you don't expect it to be short-circuiting and all your expression really have type bool
(not something convertible to bool
, like pointers, integers, or user-defined objects), it works. That's a lot of restrictions though.
No, & is a bitwise and, && is boolean and. If dosmthing* returns something other than 1 or 0, the results will be different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With