From 7446024354913998262
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ede379f5dbbc1549
X-Google-Attributes: gidf78e5,public
From: Max TenEyck Woodbury <mtew@cds.duke.edu>
Subject: Re: Suggestion: "typeof" keyword
Date: 1999/08/17
Message-ID: <37B98C74.5E30D322@cds.duke.edu>#1/1
X-Deja-AN: 513898647
Content-Transfer-Encoding: 7bit
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> <t7r9laz5hj.fsf@calumny.jyacc.com> <7oup0a$8g2$1@nnrp1.deja.com> <37B3C2AD.5AB722AE@lucent.com> <37B5A571.449B@wanadoo.fr> <37B908A8.717CAC2C@lucent.com>
X-Original-Date: Tue, 17 Aug 1999 12:23:16 -0400
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 934916388 8248 128.250.29.17 (17 Aug 1999 18:59:48 GMT)
Organization: Duke University, Durham, NC, USA
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN7mxB+EDnX0m9pzZAQEY0AGAgAOIqREohNxJ85GGxQgt0xCoO4uUerOq frTvAHY+URKiYecoue2oPb6+drWaBulE =11sY
Mime-Version: 1.0
NNTP-Posting-Date: 17 Aug 1999 18:59:48 GMT
Newsgroups: comp.std.c++

Salters wrote:
> 
> Valentin Bonnard wrote:
> 
>> Salters wrote:
>> 
>>> sirwillard@my-deja.com wrote:
>>> 
>>>> What should be the result of the
>>>> following?
>>>> 
>>>> base* p = new derived;
>>>> typeof(*p) copy(*p);
>>> 
>>> A syntax error?
>> 
>> Do you suggest that
>> 
>>     int i (3);
>> 
>> should be a syntax error ?
> 
> Of course not. However, lacking a formal syntax, I do not know
> which *p are turned into types. That's why I put a question mark
> after error. Thinking about it, I'm not sure how the formal syntax
> should be, but it is reasonable to assume typeof() evaluates to a
> type. This would definitely require some major standards work,
> since currently nothing evaulates to a type.
> 
1.  Not a syntax error, but a semantic diagnostic might be in order.
    If the compiler tracks the right kind of information, the fact
    that only part of the structure is being copied might be noted
    in an informational message.

2.  A macro can evaluate into anything, including a type. (re
    another thread that raised questions about run-time behavior:
    Macros are compile time only.) Template arguments are type 
    variables so why not a compile time type function? (And they are
    compile time only.)

3a. There have been at least semi-formal proposals that indicate that
    proper phrasing is feasible.
3b. The exact placement in the standard is a detail that should be left
    to the standard committee, but it obviously belongs in the declaration
    and types section of the standard rather than in the library section.
3c. The major problem is conceptual, and that is what this discussion is
    working on. Translating the result into 'standard speak' should be
    little different from adding any other feature to the standard.

mtew@cds.duke.edu
---
[ 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              ]



