[futurebasic] Re: [FB] C translation

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2001 : Group Archive : Group : All Groups

From: Timothy Knox <tdk@...>
Date: Thu, 31 May 2001 20:22:17 -0500
Somewhere on Shadow Earth, Alain Pastor wrote:

>Can someone tell me what the following C statement does?
>*address++ ^= value;

Sure. Let's take it in steps.
1. address -- is a pointer to some memory.
2. *address -- is the data pointed at.
3. *address ^= value -- exclusive ors the data pointed at with value, and
stores the result back in the data pointed at.
4. *address++ ^= value; -- does all of that, and then increments the
value of address, so that it points to the next memore address. N.B. This
does not necessarily mean the next byte. If address is a pointer to longs
(32 bit or 4 byte ints) then address++ increments address by 4. In other
words, if address was: 0x0100, and address pointed to longs, address++
would be 0x0104. Hope this helps, but if not, please don't hesitate to ask.
Timothy Knox
"Stupidity is like nuclear power. It can be used for good or evil,
and you don't want to get any on you." -- Scott Adams