------- Comment #3 from lbana at hotmail dot com 2007-05-05 05:01 ------- Subject: RE: bug in g++ a.out for stl::map
Dear Gnu, Sorry for logging invalid bug, I should have spend some time in reading it. I thought all I need to do is pass stack variable. Anyhow thanks for the advice. -Laxman >------- Comment #2 from pcarlini at suse dot de 2007-05-05 00:11 ------- >You are only passing around a pointer to name and not allocating memory for >the >various "C" strings, instead overwriting each time in the loop the same >char >array. Well, there are also other problems in the code, like not passing to >std::map as third template argument an appropriate comparison object: > >struct ltstr >{ > bool operator()(const char* s1, const char* s2) const > { > return std::strcmp(s1, s2) < 0; > } >}; > >I would suggest always using std::string, instead of "C" strings, at least >while you are still learning std::map. > > >-- > >pcarlini at suse dot de changed: > > What |Removed |Added >---------------------------------------------------------------------------- > Status|UNCONFIRMED |RESOLVED > Resolution| |INVALID > > >http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31825 > >------- You are receiving this mail because: ------- >You reported the bug, or are watching the reporter. _________________________________________________________________ Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31825