Programming magic's

 

Hey all,


while reading the forum i found code where i can't understand the operation.


set |=  state;
set &=~ state;

( full src code: https://www.mql5.com/en/forum/222650 )


What is "|=" and "&=~" doing ?


Thx && Regards

OnDeinit Cancel ?
OnDeinit Cancel ?
  • 2017.12.16
  • www.mql5.com
Hey all, is it possible to cancel a OnDeinit request ? Like i have EA1 and EA2, EA2 has dependencies on EA1...
 
Christian Stern:

Hey all,


while reading the forum i found code where i can't understand the operation.


( full src code: https://www.mql5.com/en/forum/222650 )


What is "|=" and "&=~" doing ?


Thx && Regards


See
 
Ex Ovo Omnia:

See
Thank you for you answer. I was reading the articles before and dont get the sense out of it. Why is he using this way ?
 
Because it is simpler to write and can't have typo.
V2i5i7i3o2p2 = V2i5i7j3o2p2 | 4; // This line has a typo

V2i5i7i3o2p2 |= 4;               // This line can't


Same as

V2i5i7i3o2p2 = V2i5i7j3o2p2 + 4; // This line has a typo

V2i5i7i3o2p2 += 4;               // This line can't

++V2i5i7i3o2p2;                  // One is a special case.