[Bug libstdc++/80811] out-of-line string members less efficient than they could be

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 18 04:53:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80811

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
There are typos in the example in comment #0.  Here's what it should look like:

#include <string>

void cmp (const std::string &s1, const std::string &s2)
{
  int c1 = s1.compare (s2);
  int c2 = s1.compare (s2);

  if (c1 != c2)
    __builtin_abort ();
}

void cmp (const std::string &str, const char *s)
{
  int c1 = str.compare (s);
  int c2 = str.compare (s);

  if (c1 != c2)
    __builtin_abort ();
}


More information about the Gcc-bugs mailing list