[vox-tech] anything wrong with this code?

Hai Yi yihai2004 at gmail.com
Thu May 27 19:08:35 PDT 2010


hi there:

can anyone look at these two small c++ snippets to see what's wrong
with them? I was interviewed with them...

1.
A* createA(){ return new A();}
    void fun(){createA();}
    What's wrong with the above code?


2.
for(iter=map.begin();iter!=map.end();iter++){
erase(iter++);
iter++;
  }
anything wrong with the above code? What's happened for "iter++" internally?


Thanks!
Hai


More information about the vox-tech mailing list