LWN.net Logo

Not Again

Not Again

Posted Apr 18, 2012 1:10 UTC (Wed) by jzbiciak (✭ supporter ✭, #5246)
In reply to: Not Again by tjc
Parent article: PHP: a fractal of bad design (fuzzy notepad)

It does, but it's so easy to forget some of these rules that it can lead to subtle, mind boggling errors -- errors that may not show up until you change compilers or compile flags, and may never evoke a warning from the compiler. The P_Rand() - P_Rand() example I gave elsewhere is a prime example, and I don't think anyone would have called John Carmack (or whoever wrote that idiom at id) an amateur.

So, while it's all well and good to say "Write tricky C only if you understand sequence points," there are plenty of non-tricky sequences that are nonetheless ill defined and subject to implementation defined or undefined behavior.

Throw in modern hardware and multithreading, and it's.... exciting. Sequence points only barely help you there. The Linux "memory barriers" document is an informative read.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds