home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!microsoft!hexnut!jimad
- From: jimad@microsoft.com (Jim Adcock)
- Subject: Re: Overload operator to concatenate Strings?
- Message-ID: <1992Nov17.010744.18481@microsoft.com>
- Date: 17 Nov 92 01:07:44 GMT
- Organization: Microsoft Corporation
- References: <1992Nov13.111415.1@happy.colorado.edu>
- Lines: 18
-
- In article <1992Nov13.111415.1@happy.colorado.edu> srheintze@happy.colorado.edu writes:
- |I have considered using operator|| but Plum and Saks discourage it for reasons
- |I don't completely understand. It is intuitive to old PL/I programmers to use
- |operator|| for character string concantenation. It seems logical to be
- |consistent with something that already exists rather than invent some new
- |notation.
-
- If your target audience is old PL/I programmers, then use the || notation.
-
- If your target audience is C++ programmers, then use + since that is the
- most common operator chosen to mean string cat in the C++ world.
- If you're writing an overloaded I/O operator use << and >> like iostreams
- -- these choices don't have to make much sense -- they've become established
- by convention. If you try to rethunk them now, you'll just be making
- your work gratuitously incompatible. Then again, why not get an
- existing class library with an existing string class? Why keep reinventing
- the [square] wheel?
-
-