Sunday, August 15, 2010

"Nine ways to break your systems code using volatile"

Having just done a review of some code for a client, full of 'volatile' directives with no technical justification, I relized that I have been remiss in posting a link to John Regehr's Nine ways to break your systems code using volatile.  My apologies John.


I have covered John's seminal work in uncovering problems with volatile in the past here and hereVolatiles Are Miscompiled, and What to Do about It by Eric Eide and John Regehr *must* be on your reading list if you are writing Embedded System code.


Bill Cox made a comment to my post that I completely agree with, and coding philosophy that I follow:



It requires a lot of discipline to minimize or eliminate global or non-static variables from your code, and it's worth it.


For an other tip related to 'volatile' take a read of Evaluating embedded code by Nigel Jones.