home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 15812 next >
Encoding:
Text File  |  1992-11-04  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!sgiblab!sgigate!odin!sam.wpd.sgi.com!pj
  3. From: pj@sam.wpd.sgi.com (Paul Jackson)
  4. Subject: Re: Making qsort type-safe
  5. Message-ID: <1992Nov5.050814.28150@odin.corp.sgi.com>
  6. Sender: news@odin.corp.sgi.com (Net News)
  7. Nntp-Posting-Host: sam.wpd.sgi.com
  8. Reply-To: pj@sgi.com
  9. Organization: Silicon Graphics, Research & Development
  10. References: <1992Nov4.162131.10289@cs.brown.edu> <1992Nov5.004640.24689@netcom.com>
  11. Date: Thu, 5 Nov 1992 05:08:14 GMT
  12. Lines: 25
  13.  
  14. In article <1992Nov5.004640.24689@netcom.com>, mdr@netcom.com (Marc D. Rossner) writes:
  15. |> In article <1992Nov4.162131.10289@cs.brown.edu>, sdm@cs.brown.edu (Scott Meyers) writes:
  16. |> [[ Deleted: example template wrapper for qsort ]]
  17. |> 
  18. |> Heesh, this principle of "not reinventing the wheel" can be taken to
  19. |> extremes.  It's really not THAT much effort to just write a templatized
  20. |> qsort for C++ directly (Lippman, 2nd ed. has it on page 194, in about 15 lines
  21. |> of code).
  22.  
  23. A similar qsort() is on page 94++ of Hansen's "The C++ Answer
  24. Book."  Hansen then spends another six pages and a few hundred
  25. lines of code improving it, to be more "industrial strength."
  26. The qsort in the libc nearest to me at the moment has 209 source
  27. lines, including comments.
  28.  
  29. This is not a religious issue to me -- sometimes I reuse,
  30. sometimes reimplement.  But in this case the trade offs are very
  31. clear - use the libc qsort, perhaps with the nifty wrapper Scott
  32. suggested.  Thanks Scott.
  33.  
  34. -- 
  35.  
  36.                 I won't rest till it's the best ...
  37.                 Software Production Engineer
  38.                 Paul Jackson (pj@sgi.com), x1373
  39.