Free hint: Don't use idempotent_function(foo) in the second part of a for() construct in C (probably applies to C++ as well) if you intend to change whatever it is that foo points to during the loop. You see, the compiler may perform the idempotent_function() call just once, leaving you eating sand if you, for example, chop the last character off the end of the string on every iteration. Ugh.
Not declaring any functions G_GNUC_CONST that take arguments by reference would probably help limit damage here.
Indeed, D. Knuth was right -- premature optimization is the root of all evil.
