home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16417 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.3 KB  |  29 lines

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