From 1491683822028555086
X-Google-Thread: f78e5,f1baa317914feeaf
X-Google-Attributes: gidf78e5,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!newsfeed.stanford.edu!news.kjsl.com!news.alt.net!frodo.cs.rpi.edu!not-for-mail
From: Giovanni Deretta <gpderetta@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: typeof keyword
Date: Fri, 27 Mar 2009 15:40:24 CST
Organization: http://groups.google.com
Lines: 30
Sender: cppmods@cs.rpi.edu
Approved: stephen.clamage@sun.com
Message-ID: <4c6295e4-2e8d-44e3-85cd-7e9eb9e72ce0@p11g2000yqe.googlegroups.com>
References: <488de3d4-77ac-4c01-8130-d196dec70bc8@v15g2000yqn.googlegroups.com>
  <gqdl38$gtu$1@news.mixmin.net>
  <d78092d1-73d4-4e20-b93a-9d1fb2849bb3@r15g2000vbi.googlegroups.com>
NNTP-Posting-Host: netlab.cs.rpi.edu
Content-Type: text/plain; charset=ISO-8859-1
To: (Usenet)
Return-Path: <cppmods@ruralroute.cs.rpi.edu>
X-Original-Date: Fri, 27 Mar 2009 07:32:04 -0700 (PDT)
X-Submission-Address: std-c++@netlab.cs.rpi.edu
Xref: g2news2.google.com comp.std.c++:356

On Mar 27, 4:45 am, Olivier <olivier.gr...@gmail.com> wrote:
> Why wasn't the wording "typeof" kept instead of "decltype" ?
>

Decltype has slightly different semantics than typeof as implemented
by some compilers (i.e. typeof(x) is more or less equivalent to
remove_reference<decltype(x)>::type) , so the committee changed the
name not to clash with those existing extensions.

Also the new standard has 'auto':

auto x = /expression/;

will be equivalent to:

remove_reference<decltype(/expression/)>::type x = /expression/;

While decltype is mainly useful for generic library writers, I think
'auto' will have a much more widespread usage.

--
gpd


-- 
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



