From -4398187144764242137
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!npeer.de.kpn-eurorings.net!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: dsp@bdal.de (=?ISO-8859-1?Q?Daniel_Kr=FCgler?=)
Newsgroups: comp.std.c++
Subject: Re: C++ naming ... a wide subject
Date: Tue, 28 Jun 2005 13:59:41 GMT
Lines: 53
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42c1103c$0$20188$4d4ebb8e@businessnews.de.uu.net>
References: <42c07be7$0$38043$5a6aecb4@news.aaisp.net.uk>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1119967412 11221 158.152.254.254 (28 Jun 2005 14:03:32 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 28 Jun 2005 14:03:32 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id j5SE3TUM012861
X-Accept-Language: en-us, en
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j5SDxf1f011805;
	Tue, 28 Jun 2005 23:59:41 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:5275

Hello JFB,

verec wrote:
> So, somehwere in the mid 90's, C++ introduced a host of new features
> and hence, associated keywords.
>=20

[Snipping stuff unrelated to C++]

> It might be interesting to note that, when confronted to a
> problem similar to C++ dynamic_cast naming, eg:
>=20
>    if (Foo * f =3D dynanic_cast<Foo *)(x)) {
>        // f is a Foo * or derives from Foo
>    } else {
>        std::cout << "Not a Foo!" << std::endl ;
>    }
>=20
> Java's James Gosling came up with
>=20
>    if (f instanceof Foo) {
>    }

The Java example is incomplete. The minimal necessary comparable
code would be something like:

     if (x instanceof Foo) {
        Foo f =3D (Foo) x;
     } else {
       System.out.println("Not a Foo!");
     }

So what is the main difference? The main difference I see is, that
using C++ I have the opportunity to perform a single dynamic cast
attempt where on success I can immediately use the obtained object.

I always wondered, how Java could live with the essential
double-casting idiom

     if (x instanceof Foo) {
        Foo f =3D (Foo) x;
     }

Greetings from Bremen,

Daniel Kr=FCgler

---
[ 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                       ]



