Nabil Sham
Nabil Sham

Reputation: 2345

what is this c++ gcc specific operator?

I have this code from an open source project, and was wondering what does this operator mean. what is this operator |= ? used in the following code:

uint32_t a = VALUE1 | VALUE2; 
a |= VALUE1; 

any idea ?

Upvotes: 0

Views: 84

Answers (1)

|= is not a GCC-specific operator - it is a standard C++ compound assignment operator. a |= b is roughly equivalent to a = a | b, where | is the bitwise-OR operator; except that |= has the precedence of = (very low precedence).

Upvotes: 2

Related Questions