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