Linus Torvalds' good taste argument for linked lists, explained
Pointless and bad article.<p>I compiled the presented code out curiosity on arm gcc 8.2  on godbolt.org with -O3 op and the results are:<p>(the original remove is even faster then the so called elegant or the elegant with inline)<p><pre><code>  remove_cs101:
          ldr     r2, [r0]
          cmp     r2, r1
          bne     .L3
          b       .L9
  .L6:
          mov     r2, r3
  .L3:
          ldr     r3, [r2, #4]
          cmp     r1, r3
          bne     .L6
          ldr     r3, [r1, #4]
          str     r3, [r2, #4]
          bx      lr
  .L9:
          ldr     r3, [r2, #4]
          str     r3, [r0]
          bx      lr
  
  
  remove_elegant:
          ldr     r2, [r0]
          cmp     r1, r2
          bne     .L12
          b       .L13
  .L14:
          mov     r2, r3
  .L12:
          ldr     r3, [r2, #4]
          cmp     r1, r3
          bne     .L14
          add     r0, r2, #4
  .L13:
          ldr     r3, [r1, #4]
          str     r3, [r0]
          bx      lr
  
  remove_elegant_with_inline:
          ldr     r2, [r0]
          cmp     r1, r2
          cmpne   r2, #0
          bne     .L17
          b       .L18
  .L19:
          mov     r2, r3
  .L17:
          ldr     r3, [r2, #4]
          cmp     r1, r3
          cmpne   r3, #0
          bne     .L19
          add     r0, r2, #4
  .L18:
          ldr     r3, [r1, #4]
          str     r3, [r0]
          bx      lr

</code></pre>
EDIT: Hmmm, so much downvote without any reply.<p>Well if your code needs an article to be explained, rather than the plain solution and brings nothing, even 1 instruction slower, as the compiler can&#x27;t make the same (faster) result as the plain solution, than your code is pointless. And stating that this is the elegant solution is IMO bad practice.