Quote:
Wrong. Prefix incrementation is modify-read. In a language sense, anyway. Assembly-wise yes, but what does it matter? The 'modify' part is atomic and that's what this implementation requires.
Thread A reads variable X into register F.
Thread B reads variable X into register G.
Thread A increments register F.
Thread A writes register F to variable X.
Thread B increments register G.
Thread B writes register G to variable X.
Times X was incremented: 2.
New value of X: X+1.
Your absolutely right, the 'modify part' of ++X was so atomic that the operations didn't stomp on each other at all.
Quote:
I'm sure that would be important if I were using C++ exceptions or anything that can throw a C++ exception in this code.
You default-constructed a rather large number of messages. If any of those constructors throws, you leak.
Quote:
Sure, I'll give you the fact that it would be about the same implementation time. But what actual features would it offer me? Apart from resizing, which I have said repeatedly is of absolutely no use or consequence to me?
Exception safety, automatic memory release, and insurance against you screwing up.
Quote:
Oh, and just in case you missed it, here is the rest of my post that you ignored completely. Possibly because you have no way to argue against it whatsoever.
I find it amazing that I both ignored it and quoted it at the same time!