Poll: Did you know about the XOR Linked List before this thread?

Be advised that this is a public poll: other users can see the choice(s) you selected.

Results 1 to 2 of 2

Thread: Neat Linked List Trick [C]

  1. #1
    Join Date
    Jul 2016
    Posts
    156
    Mentioned
    2 Post(s)
    Quoted
    81 Post(s)

    Lightbulb Neat Linked List Trick [C]

    I was reading on some documentation for D, when I stumbled upon these line:
    1. "Do not xor pointers with other values, like the xor pointer linked list trick used in C."
    2. "Do not use the xor trick to swap two pointer values."

    I had never heard of these tricks before so I looked into them. When I was first introduced to linked lists I got the traditional approach (which makes sense for a novice). But wow the XOR linked list is a really neat trick. Check out the links below to find out more:

    http://stackoverflow.com/questions/1...nked-list-work
    http://www.geeksforgeeks.org/xor-lin...ed-list-set-1/

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Suburbia View Post
    I was reading on some documentation for D, when I stumbled upon these line:
    1. "Do not xor pointers with other values, like the xor pointer linked list trick used in C."
    2. "Do not use the xor trick to swap two pointer values."

    I had never heard of these tricks before so I looked into them. When I was first introduced to linked lists I got the traditional approach (which makes sense for a novice). But wow the XOR linked list is a really neat trick. Check out the links below to find out more:

    http://stackoverflow.com/questions/1...nked-list-work
    http://www.geeksforgeeks.org/xor-lin...ed-list-set-1/


    http://pastebin.com/vSnEeE56

    I am Ggzz..
    Hackintosher

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •