Here's one of several real-world examples that I found from our CMS (it's a bit tricky to grep after these constructs...):
#define quote(X) (replace((X)||"", "'", "'"'"'")) [...] "<var name='destname' type='string' size='40' default='" + quote(sbobj->name(id)) + "' />"
A sbobj->name() returning "'foo'" would then produce:
<var ... default=''"'"'foo'"'"'' />
Whether this is a guarantee that we never concatenate two strings with same quote char I don't know, but I'd rather preserve any such backwards compatibility than the very-odd quoted attribute _name_ syntax which I've never seen used.