2 Replies - 269 Views - Last Post: 04 July 2013 - 05:49 PM Rate Topic: -----

#1 Mr_Fraggs  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 89
  • Joined: 17-June 12

|= Operator

Posted 04 July 2013 - 05:07 PM

Hey everyone, and happy 4th of July to those who celebrate it! I have a quick, possibly simple question. What is the |= operator in C++? I've been practicing DirectX and I see it a lot, but when I try to google it, I can't find anything. It's probably because searching "C++ |= Operator" and other related searches tends to not recognize the |= in the search, and only returns results like operator overloading tutorials. (If it has to do with operator overloading, i'm going to look pretty silly!)

I know || is the Or operator, and I believe one | is the binary(?) version of the operator, but I can't find the combination of |=.

Thanks guys!

This post has been edited by Mr_Fraggs: 04 July 2013 - 05:08 PM


Is This A Good Question/Topic? 1
  • +

Replies To: |= Operator

#2 vividexstance  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 678
  • View blog
  • Posts: 2,331
  • Joined: 31-December 10

Re: |= Operator

Posted 04 July 2013 - 05:12 PM

In C/C++ there are logical operators like || (or), && (and), and then there are the bitwise operators like | (or), & (and). Any operator can be combined with the equals sign to make it easier for people to use.
Like a = a + b becomes a += b. So instead of having a = a | b you would have a |= b,
Was This Post Helpful? 3
  • +
  • -

#3 Mr_Fraggs  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 89
  • Joined: 17-June 12

Re: |= Operator

Posted 04 July 2013 - 05:49 PM

Ah, thank you very much! I knew of the += and -= etc. operators, but I didn't piece that together. And when I said binary operators, I guess I meant bitwise :P

Thanks for the help!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1