------- Additional Comments From chris at bubblescope dot net 2005-07-01 09:47 ------- After a little thought (sorry, should have done it before), this bug all comes down to the order of execution of function parameters, which I believe is undefined?
BTW, in case I wasn't clear enough in mail before, my belief now is that this is not a bug. There are two fixes I can think of. 1) Only call inet_ntoa once per statement. 2) Wrap the return of inet_ntoa in string(), so the first thing you do when you get back the char* pointer is copy the string it points to into a std::string. For example, your program works if I replace the nearly last line with: cout << "Key: " << string(inet_ntoa(itor->first.sin_addr)) << ", " << itor->first.sin_port << endl << "Value: " << string(inet_ntoa(itor->second.sin_addr)) << ", " << itor->second.sin_port << endl << endl; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22265