Friday, February 04, 2005

vector<char>, push_back(0) and XP SP2

Just spent some time debugging an intermittent exception that only seemed to happen on Windows XP, service pack 2. I had a vector<char>, and called push_back(0), expecting the implicit conversion to char& to suffice when terminating data that was going to become a string.

Replacing it with push_back('\0') worked.

No comments :