home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19851 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.8 KB  |  48 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mole-end!mat
  3. From: mat@mole-end.matawan.nj.us
  4. Subject: Re: Type-cast to void
  5. Message-ID: <1993Jan25.012051.13911@mole-end.matawan.nj.us>
  6. Summary: function-style cast is `value builder' is necessary!
  7. Organization: :
  8. References: <1993Jan17.143532.15949@mnemosyne.cs.du.edu> <dak.727311054@hathi> <898@ulogic.UUCP>
  9. Date: Mon, 25 Jan 1993 01:20:51 GMT
  10. Lines: 36
  11.  
  12. In article <898@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
  13. > In article <dak.727311054@hathi> dak@hathi.informatik.rwth-aachen.de (David Kastrup) writes:
  14. > >grimmer@nyx.cs.du.edu (Geoff Rimmer) writes:
  15.  
  16. > >In my opinion, function
  17. > >style casts were a mistake from the beginning. They ambiguate code,
  18. > >gain nothing, and typedefs, constructors and functions form an amorph
  19. > >mishmash.
  20.  
  21. > I do not know if this is a legitimate statement
  22. >     x = (X) i;
  23. > which *would* have been the way to write a cast if we did not
  24. > use the constructors instead.  ...
  25.  
  26. Yes, it is.  The symmetry, while not perfect, is strong.
  27.  
  28. > use the constructors instead.  The functional syntax of casting:
  29. >     i = int(x);
  30. > is merely for symmetry with the class constructors.  I think that
  31. > a constructor is NOT a cast, and this is a false symmetry.  And
  32. > that the idea of functional style of casting should have been 
  33. > strangled in the cradle!
  34.  
  35. There's another important use, the `constructor-as-expression,' for
  36. which someone long ago coined the unofficial term `value builder':
  37.  
  38.     const Point origin( 0.0, 0.0 );
  39.     Rectangle working_extent = exent.intersection(
  40.                     Rectangle( origin, z.ne() ) );
  41.  
  42. This looks clumsy, but try to write the equivalent code otherwise!
  43. -- 
  44.  (This man's opinions are his own.)
  45.  From mole-end                Mark Terribile
  46.  
  47.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  48.