Saturday 15 June 2013

c++ - Is &= guaranteed to behave like hypothetical &&= operator? -


Sometimes I want to do

  bool success = true; Success & amp; = Dosmthing1 (); Success & amp; = Dosmthing2 (); Success & amp; = Dosmthing3 (); If (success)   

I'm using exceptions that ignores ... My question is that the C ++ standard is guaranteed that & amp; = will behave like nonexisting for the case of my use & amp; Amp; Amp; = Amp; ...

Edit: smthing-s return bool

It depends on you to work & amp; Amp; = Amp; = How to expect if you see the x & amp; Amp; = Y (); If you want to be equal to x = x & amp; Amp; Y (); , not so, because this expression does not call y () if x starts as incorrect, but x & Amp; ; = Y (); will be.

If you do not expect it to be a short circuit and all your expressions are actually typed in bool (do not allow some to be bool , pointers, Integers, or variables for user-defined objects), it works though it has many restrictions.

No comments:

Post a Comment