🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #28

libg++-2.2 bug in String class

#28
From: 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)
Technical Details
Message-ID: <tietz.713003688@gmd.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!gmd.DE!tietz

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!gmd.DE!tietz
From: tietz@gmd.DE (Christoph Tietz)
Subject: libg++-2.2 bug in String class
Message-ID: <tietz.713003688@gmd.de>
Sender: gnulists@ai.mit.edu
Organization: GMD, Sankt Augustin, Germany
Distribution: gnu
Date: Wed, 5 Aug 1992 08:34:48 GMT
Approved: bug-lib-g++@prep.ai.mit.edu
Lines: 45