[Gllug] XOR

Nix nix at esperi.org.uk
Sat Apr 17 19:50:05 UTC 2004


On Thu, 15 Apr 2004, Pete Ryland uttered the following:
> On Thu, Apr 15, 2004 at 05:09:53PM +0100, Ashley Evans wrote:
>> One can implement a doubely linked-list using .
> 
> Hmm.. I'll have to look into this one - sounds dodgy though, playing with
> pointers like such.

You certainly can't use the xored-pointers trick in modern C code: it's
a blatant violation of the ISO C aliasing rules.

>> As a newbie programmer I think xor is about a great as functions come.
>> 
>> So, what else can this bit of binary operator magic be used for?
> 
> In hardware, it's used to perform addition.

It's used for all sorts of things. It's a basic mathematical operator,
for godsake. You might as well ask what addition could be used for :)

-- 
`If you believe in strong AI, then death is no longer a mystery,
 but merely a lack of adequate backups.' --- Steven McDougall
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list