Menu

Problem with string comparison

2002-10-30
2012-09-26
  • Nobody/Anonymous

    This is a fragment from a member function:

    Thisword is a string&, firstnode a pointer to a struct where word is a member string.

    if (thisword  <  firstnode->word)
    {
        firstnode = temp;
    }

    In some circumstances where Thisword is alphabetically before firstnode->word, firstnode = temp does not execute. It seems to happen when Thisword has the same letters as the first letters of firstnode->word: i.e. a after an, or zig after zigzag.

    Is this a feature, a bug, or am I missing something obvious?

    I have Dev-C++ 4.01 and gcc 2.95.

    Thanks

    Derek

     
    • Nobody/Anonymous

      Found the problem it was upstream from the comparison; so ignore the message.

      Thanks

      Derek

       
    • Nobody/Anonymous

      Ignore my original post.

      Found the problem: it wasn't with the comparison, but further upstream.

      Thanks.

      Derek

       
    • Nobody/Anonymous

      Ignore my original post.

      Found the problem: it wasn't with the comparison, but further upstream.

      Thanks.

      Derek

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.