home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12392 < prev    next >
Encoding:
Text File  |  1992-08-15  |  1.3 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mole-end!mat
  3. From: mat@mole-end.matawan.nj.us
  4. Subject: Re: Temporary variables and unnamed objects
  5. Message-ID: <1992Aug16.080334.27587@mole-end.matawan.nj.us>
  6. Keywords: Constructors,temporary,unnamed
  7. Organization: :
  8. References: <1992Aug10.143831.29819@bnr.ca> <BszD04.7Ao@world.std.com>
  9. Date: Sun, 16 Aug 1992 08:03:34 GMT
  10. Lines: 27
  11.  
  12. In article <BszD04.7Ao@world.std.com>, pkturner@world.std.com (Prescott K Turner) writes:
  13.  
  14. > > Finally, the ARM says that the constructor is not true a callable function
  15. > > which has no return type, yet cfront allows:
  16. > > 
  17. > >   Object(3).doSomething()
  18. > > 
  19. > > which implies that constructors *DO* return values (i.e., the object being
  20. > > constructed,) and that it returns an lvalue.
  21.  
  22. > Here, you've made the common error of mistaking Object(3) for a function
  23. > call, when it's actually an explicit conversion (ARM 5.2.3).
  24.  
  25. This is true, but perhaps not quite complete.  If the constructor took
  26. several arguments, you could still use it:
  27.  
  28.         x += Complex( alpha, ( alpha + 1 ) / beta );
  29.  
  30. Thus expression are permitted beyond what conversions alone allow.
  31.  
  32. I somewhere saw this construct called a `value builder' and I like
  33. the term.
  34. -- 
  35.  (This man's opinions are his own.)
  36.  From mole-end                Mark Terribile
  37.  
  38.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  39.