From -4645628073328886340
X-Google-Thread: f78e5,860edfd5ffaa1c7d
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 29 Jun 2005 10:00:17 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: kanze@gabi-soft.fr
Newsgroups: comp.std.c++
Subject: Re: C++ naming ... a wide subject
Organization: http://groups.google.com
Message-ID: <1120044512.173084.186920@g43g2000cwa.googlegroups.com>
References: <42c07be7$0$38043$5a6aecb4@news.aaisp.net.uk>
   <42c1103c$0$20188$4d4ebb8e@businessnews.de.uu.net>
   <IIt4M2.D0v@beaver.cs.washington.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: g43g2000cwa.googlegroups.com; posting-host=62.160.54.162;
   posting-account=qsfl8gwAAABZGaLp2a7FeTfDkJamzWYW
X-Virus-Scanned: amavisd-new at ucar.edu
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mailman.ucar.edu id j5TBT8dc001425
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Date: Wed, 29 Jun 2005 09:54:40 CST
Lines: 50
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-BFjmxtq/sKTgxkdWUQlvXIKDNp74to8o2YsNmSXrQdtO0WYiOnuj2KWO1OMxOlRz101n9AIA3OHeQRE!QtDn+qWd7k0cn0SxbKIofloDryGsT3FcFD5jLRdsyrEtZu1+824z+ouiZlS0RGG6Ha1MZ22rl4VS!th5/yT5oPZmrcNIpEhkqUj3iiECs5Zta/50jTuqDSIo=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news1.google.com comp.std.c++:5301

"Andrei Alexandrescu See Website For Email wrote:
> Daniel Kr�gler wrote:
> > I always wondered, how Java could live with the essential
> > double-casting idiom

> >     if (x instanceof Foo) {
> >        Foo f = (Foo) x;
> >     }

> It is an inconvenience to the programmer; for the record,
> that's a low-hanging fruit for the simplest optimizers.

I don't think Daniel's point concerned runtime.  It's a
potential source of errors -- I have to repeat the name of the
class three times in order to say I want to use it.  And an
error in the first instance won't even cause a compile time
error.

Note that certain people consider the fact that I have to repete
the name of the type twice in C++ is a weakness, and propose
typeof or something like that as an improvement.

(And of course, the original problem can be solved with only
repeating the name twice in Java:

    try {
        Foo f = (Foo) x ;
        //  ...
    } catch ( ClassCastException error ) {
        System.out.print( "..." ) ;
    }

I don't like it; if forces you to put the short, exceptional
case at the end, whereas I prefer to keep the shorter branch
near the top.  Not to mention that "exception" says something
that I may not mean here.)

--
James Kanze                                           GABI Software
Conseils en informatique orient�e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34


---
[ 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://www.jamesd.demon.co.uk/csc/faq.html                       ]



