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