4856 bawrite (bp) struct buf *bp; { register struct buf *rbp; rbp = bp; rbp->b_flags =| B_ASYNC; bwrite (rbp); }
The second last statement is interesting because it could have been written as
rbp->b_flags = rbp->b_flags | B_ASYNC;
In this statement the bit mask “B ASYNC” is “or”ed into “rbp-b_flags”. The symbol “|” is the logical disjunction for arithmetic values.
This is an example of a very useful construction in UNIX, which can save the programmer much labour. If “O” is any binary operator, then
x = x O a;
where “a” is an expression, can be rewritten more succinctly as
x =O a;
A programmer using this construction has to be careful about the placement of blank characters, since
x =+ 1;
is different from
x = +1;
What is to be the meaning of
x =+1; ?