home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13234 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.8 KB  |  43 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!news.mentorg.com!sdl!adk
  3. From: adk@Warren.MENTORG.COM (Ajay Kamdar)
  4. Subject: Re: istrstream
  5. Message-ID: <1992Sep2.223918.2436@Warren.MENTORG.COM>
  6. Organization: Mentor Graphics Corp. - IC Group
  7. References: <1992Sep1.225259.1533@Warren.MENTORG.COM> <1814g7INNr59@agate.berkeley.edu> <1992Sep2.163001.2107@Warren.MENTORG.COM>
  8. Date: Wed, 2 Sep 1992 22:39:18 GMT
  9. Lines: 32
  10.  
  11. Follow up to my own previous post:
  12.  
  13. In article <1992Sep2.163001.2107@Warren.MENTORG.COM> adk@Warren.MENTORG.COM (Ajay Kamdar) writes:
  14.  
  15. >It is unfortunate that the fact that strstreambase has a char* CTOR should
  16. >dictate that istrstream should have a char* CTOR too. I would have much
  17. >preferred that the istrstream have a const char* CTOR, and that the
  18. >istrstream class cast away the const to create the strstreambase part of
  19. >it self. Along with casting away the const internally, istrstream would
  20. >also set up some other conditions in strstreambase which would ensure that
  21. >even though the strstreambase was created with a char* argument, it does not
  22. >actually modify the buffer. This would making the cast away of the const
  23. >purely an implementation detail of the istrstream class while still
  24. >maintaining the constness of its CTOR argument.
  25. >
  26.  
  27. BTW, I agree that casting away the const in the implementation is not the
  28. only way to make the istrstream have a constructor taking a const char*.
  29. Nor is it necessarily the best way. There are other ways of achieving the
  30. same results which could be considered linguistically more pure (i.e., do
  31. not resort to cast away const.)
  32.  
  33. People's mileage varies on this issue, so I hope I have not rekindled the
  34. debate on the virtues of casting away const.
  35.  
  36. - Ajay
  37.  
  38. -- 
  39. I speak for none but myself.
  40.  
  41. Ajay Kamdar                               Email : ajay_kamdar@mentorg.com
  42. Mentor Graphics, IC Group (Warren, NJ)    Phone : (908) 580-0102
  43.