🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gnu.g++.lib.bug
1 messages
1 total messages Started by Christoph Tietz Wed, 05 Aug 1992 08:34
libg++-2.2 bug in String class
#28
Author: Christoph Tietz
Date: Wed, 05 Aug 1992 08:34
44 lines
1754 bytes
We are using g++-2.2.2, libg++-2.2 on a SUN4 running SunOS 4.1.2

The code fragment:
-------------------------------------------------------------------------------
#include <stream.h>
#include <String.h>

main () {
  String line = "abcdefgh";
  if (line.after ('c').contains ('g'))
    cout << "found\n";
  else
    cout << "not found\n";
}
-------------------------------------------------------------------------------
fails, because the 'contains' operation for SubString objects, that takes a
char as argument fails.
The following patch fixes the problem for me:

--------------- snip - snip ---------------------------------------------------

*** /vol/gnu/src/generic/libg++-2.2/libg++/src/String.h	Sat Apr 18 01:50:54 1992
--- String.h	Tue Aug  4 15:20:27 1992
***************
*** 1074,1080 ****
  
  inline int SubString::contains(char c) const
  {
!   return S.search(pos, pos+len, 0, c) >= 0;
  }
  
  inline int SubString::contains(const Regex& r) const
--- 1074,1080 ----
  
  inline int SubString::contains(char c) const
  {
!   return S.search(pos, pos+len, c) >= 0;
  }
  
  inline int SubString::contains(const Regex& r) const

-------------------------------------------------------------------------------

                          Christoph Tietz (tietz@gmd.de or tietz@zi.gmd.dbp.de)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads