8 June 2006

Hilarious

// Preconditions: variable i in memory
// Post conditions: variable i incremented by one
// Method:
//1: fetch i from memory into register
//2: increase register value by 1
//3: write value of register into memory
i++;

From Fred Emmott.

Updated: This is interesting for two other reason, now I have the prefix operator (++i;) fixed in my head, and there is actually a need for such documentation: Interlocked.Increment Method (.NET’s System.Threading namespace).

Paul at 3:09 am



1 Comment

  1. Pre Increment/Decrement (+i/-i) commit the action, then return its new value, whereas Post Increment/Decrement (i+/i-) return the current value, then commit the change.

    Comment by Paul — July 13, 2006 @ 2:15 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.