From -5777492351216852526
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/23
Message-ID: <37C1B67F.B5B0B51A@cds.duke.edu>#1/1
X-Deja-AN: 516333808
X-NNTP-Posting-Host: dukcds.cds.duke.edu
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
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> <CVJFZFAbaWu3Ew15@robinton.demon.co.uk> <7pcvjs$tk4$1@nnrp1.deja.com> <user-1808991258230001@aus-as3-121.io.com> <7phk8n$b26$1@nnrp1.deja.com> <37BD2185.C0047293@physik.tu-muenchen.de> <7pk6r6$689$1@nnrp1.deja.com>
X-Accept-Language: en
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
Organization: Duke University, Durham, NC, USA
Mime-Version: 1.0
Newsgroups: comp.std.c++
Originator: clamage@taumet


'const' and 'volatile' are distinct attributes from the basic type
of a data item. If they appear at the top level, they should be
removed. After all, the main purpose of 'typeof' is to allow
correctly typed copies to be instanced. One of the reasons for 
making the copy of something is to manipulate it in some way while 
leaving the original unchanged. Preserving 'const' at the top level
could prevent this.

In the one bad example given, some trouble was taken to throw away
'const' at a lower level.

The original was

> any_type foo;
> typeof(foo)* bar = &foo;
>
> And now assume any_type is int const.

The correct way to do this would be:

any_type foo;
typeof(&foo) bar = &foo;

With any_type as int const, bar's type is * int const.

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              ]




