------- Additional Comments From chris at bubblescope dot net  2005-07-01 09:12 
-------
on 4.0.0, ppc-darwin I don't see this problem.

On x86-cygwin 3.4.4 I do, but I don't think it has anything to do with map, or
net, or anything.

Consider the following program below. It prints:

bat:bat

on x86-cygwin 3.4.4

and

bat:zat

on ppc-darwin current CVS

inet_ntoa returns a char* to a fixed internal buffer which contains the decoded
net string. You are calling this function twice in one statement, and if you
print the pointers you are returned you'll find (or at least I find, and I can't
see how it could be otherwise) that these pointers are identical.

Now another question, which I'm not 100% certain at the moment and am happy to
have input on, is what about output this program should give, or if it is 
undefined.

#include <iostream>
char foo[10]="cat";
char* writestring()
{
 foo[0]='b';
 return foo;
}

char* write2()
{
 foo[0]='z';
 return foo;
}


int main(void)
{ std::cout << writestring() << ":" << write2() << std::endl; } 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22265

Reply via email to