From 5817611104967022888
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ede379f5dbbc1549
X-Google-Attributes: gidf78e5,public
From: niklasb@my-deja.com
Subject: Re: Suggestion: "typeof" keyword
Date: 1999/08/31
Message-ID: <7qeqk0$a67$1@nnrp1.deja.com>#1/1
X-Deja-AN: 519180466
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7nt3vl$1oe$1@nnrp1.deja.com> <7oh7o8$t3f$1@nnrp1.deja.com> <7ol6hi$ej9$2@news.BelWue.DE> <cTiioXAhAwr3Ew$X@robinton.demon.co.uk> <t7d7ww1vrz.fsf@calumny.jyacc.com> <e4DSyfA4ALs3Ew0Q@robinton.demon.co.uk> <t7hfm6ytow.fsf@calumny.jyacc.com> <120819991357412479%lisa_lippincott@advisories.com> <slrn7rbjp3.dom.sbnaran@localhost.localdomain> <37BBDDCA.90D590D4@physik.tu-muenchen.de> <slrn7rph9n.e43.sbnaran@localhost.localdomain> <37C3DA57.25C88799@physik.tu-muenchen.de>
X-Original-Date: Mon, 30 Aug 1999 20:46:59 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
X-Complaints-To: news@news.unimelb.edu.au
X-Http-Proxy: 1.0 RED-PRXY-10, 1.0 x36.deja.com:80 (Squid/1.1.22) for client 131.107.3.70
X-Trace: izvestia.its.unimelb.edu.au 936077914 17940 128.250.37.153 (31 Aug 1999 05:38:34 GMT)
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Mon Aug 30 20:46:59 1999 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN8tqReEDnX0m9pzZAQFXzgF9HG/NlMsIY2BqVvQk1VAmnlDxfAyLVpzO r+N5/eE+48++oU+WhGZ9mGh/gTUCgyq8 =3XeT
X-MyDeja-Info: XMYDJUIDniklasb
NNTP-Posting-Date: 31 Aug 1999 05:38:34 GMT
Newsgroups: comp.std.c++

In article <37C3DA57.25C88799@physik.tu-muenchen.de>,
  Christopher Eltschka <celtschk@physik.tu-muenchen.de> wrote:
> "Siemel B. Naran" wrote:
> >
> > On 19 Aug 1999 16:39:34 GMT, Christopher Eltschka
> > >"Siemel B. Naran" wrote:
> >
> > >> In one of my posts I used this
> > >>    typeof(A*B+C) MultiplyAdd(...) { ... }
> >
> > >That's problematic:
> > >
> > >class X {};
> > >class Y { Y operator*(); };
> > >X operator*(X, Y);
> > >Y operator*(X*, Y);
> > >
> > >typeof(X**Y) a
> >
> > The notation "X*" to mean pointer to an 'X' is wrong.
>
> According to the current rules of writing types, writing
> "X*" to mean "pointer to X" is right.

Which simply demonstrates that the operand of typeof
should be an expression, not a type.

If A, B, and C are types, then typeof(A*B+C) would be
illegal because A*B+C is not an expression. What you're
looking for, I think, is

  typeof( A()*B()+C() )

or if you prefer cast notation:

  typeof( (A)0 * (B)0 + (C)0 )

Either could be read, "the type of (the result of) an
expression that: adds two objects of types A and B,
and then adds their sum with an object of type C."


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



