Topic: T(a) again...(problems with the ARM)


Author: tkaras@mason1.gmu.edu (Theodore Karas)
Date: 9 Mar 1994 20:28:52 GMT
Raw View
In article <2l8bu4$pv5@portal.gmu.edu> tkaras@mason1.gmu.edu (Theodore Karas) writes:
>There was a thread about this recently, but questions still remain.
>Where in the ARM is the meaning of this expression discussed?
>Section 6.8/p.93 gives examples of its use, but what does it mean?

I was referred to 5.2.3/p.52, where there is a further discussion of
T(a). From what others have said, it seems that T(a) creates a
temporary object(for classes), and that T(a) is also a symbol for
this temporary object, since statements such as T(a).i are acceptable.
However, looking at 6.8 I am confused, since in the context of what I
just stated, expressions such as T(a)++ do not make any sense. Of
course, statements such as
  Base base = base(4);
do make sense,
since this can be interpreted in terms of an object assignment
('object' here referring to an instance of a class).
You could interpret T(a)++ as an operator overloaded expression
relative to 'T', but I'm wondering if the 'T(a)' in 6.8 represents
something different than the 'T(a)' in 5.2.3? One reason for this is
that 6.8 concerns ambiguity resolutions between expression-statements
and declarations, which seems broader than just applicable to statements
as described in 5.2.3. Of course, that section is supposed to be about
"Explicit Type Conversion", which I don't understand at all relative to
'T(a)' statements. All in all, quite a mess. Any thoughts?

-ted

ps. It seems more and more that the Emperor has no clothing, or at
least needs a new tailor.




Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Wed, 16 Mar 1994 04:50:01 GMT
Raw View
In article <2llbi4$14d@portal.gmu.edu> tkaras@mason1.gmu.edu (Theodore Karas) writes:
>However, looking at 6.8 I am confused, since in the context of what I
>just stated, expressions such as T(a)++ do not make any sense.

 Sure they do.

>ps. It seems more and more that the Emperor has no clothing, or at
>least needs a new tailor.

 He has one. The C++ committee. They just sew rather slowly.

--
        JOHN (MAX) SKALLER,         INTERNET:maxtal@suphys.physics.su.oz.au
 Maxtal Pty Ltd,      CSERVE:10236.1703
        6 MacKay St ASHFIELD,     Mem: SA IT/9/22,SC22/WG21
        NSW 2131, AUSTRALIA




Author: olaf@cwi.nl (Olaf Weber)
Date: Mon, 7 Mar 1994 12:26:30 GMT
Raw View
In article <2l8bu4$pv5@portal.gmu.edu>, tkaras@mason1.gmu.edu (Theodore Karas) writes:

> There was a thread about this recently, but questions still remain.
> Where in the ARM is the meaning of this expression discussed?
> Section 6.8/p.93 gives examples of its use, but what does it mean?
> As an example I used BC++3.1 to write this simple program.

Section 5.2.3 (page 52), called ``Explicit Type Conversion''.

> -----------------------------------------------
> #include <iostream.h>

> class Base{
> public:
>   Base(){ cout << "default\n"; }
>   Base(int i){ cout << i; }
>   Base(int i, int j){ cout << j; }
> };

> main()
> {
>   Base base;
>   base = Base(4);
> }
> -------------------------------------------
> Here is the output:
> default
> 4

> What's going on?

For `Base base;', a Base object is constructed using the default
constructor.

For `base = Base(4);', a temporary object of type Base is constructed,
using the `Base::Base(int)' constructor with argument 4.  This object
is then assigned to `base'.

> -ted

-- Olaf Weber




Author: tkaras@mason1.gmu.edu (Theodore Karas)
Date: 4 Mar 1994 22:15:32 GMT
Raw View
There was a thread about this recently, but questions still remain.
Where in the ARM is the meaning of this expression discussed?
Section 6.8/p.93 gives examples of its use, but what does it mean?
As an example I used BC++3.1 to write this simple program.

-----------------------------------------------
#include <iostream.h>

class Base{
public:
  Base(){ cout << "default\n"; }
  Base(int i){ cout << i; }
  Base(int i, int j){ cout << j; }
};

main()
{
  Base base;
  base = Base(4);
}
-------------------------------------------
Here is the output:
default
4


What's going on?

-ted