This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

funny strstream bug (yes I know it's deprecated)


People probably don't care about strstream any more but I still 
thought this was an interesting one.

Self contained bug example follows:

---------------------------------------
#include <string>
#include <strstream>

int main(){
  std::string fred = "                
some_spaces_precede_a_single_exceedingly_long_word 1 ";
  istrstream arguments((fred+" ").c_str());
  std::string base;
  arguments >> base;
  int L;
  arguments >> L;
  cerr << "L " << L << '\n';
}

// Expected output: L 1
// Actual output on my system: L 0  (??!!)
----------------------------------------

Puzzlingly, the code can be made to work by replacing the words 
'exceedingly long' by 'short' in std::string fred. 

I'm running today's download of Cygwin and gcc on Win2000.

Any enlightenment welcome.

Yours
Brian Bull 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]