From 8727415790302054259
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,b43d17d27e7171b0
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2000-12-13 07:55:05 PST
Path: supernews.google.com!sn-xit-02!supernews.com!router1.news.adelphia.net!cyclone.news.idirect.com.MISMATCH!newsfeed.direct.ca!look.ca!newsfeed.icl.net!colt.net!dispose.news.demon.net!demon!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Daniel Frey <d.frey@aixigo.de>
Newsgroups: comp.std.c++
Subject: Re: explicit operator T()
Date: Wed, 13 Dec 2000 15:54:43 GMT
Organization: aixigo AG
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3A3791B1.E2875EEC@aixigo.de>
References: <3A2D10EE.35544D0A@aixigo.de> <t2qout2pnv435b@corp.supernews.com>
	 <3A2E0413.96D42EFD@aixigo.de> <3A2F5BF8.B8CFDBED@physik.tu-muenchen.de> <byAY5.313$It.129281@news.pacbell.net>
X-Trace: mail2news.demon.co.uk 976722890 mail2news:4485 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
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)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Sender: 320060065507-0001@t-dialin.net
X-Accept-Language: en
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.cs.mu.OZ.AU id CAA02088
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id CAA04084
Lines: 42
Xref: supernews.google.com comp.std.c++:2949

Gene Bushuyev wrote:
>=20
> This opens a floodgate of problems. How do you decide what conversions
> "explicit" should prevent? How about promotions? How about identity
> conversions? Will derived-to-base class conversion be allowed? If you s=
ay
> any conversion is disallowed with "explicit" then it's usefulness is ne=
xt to
> nil.

IMHO 'explicit' for parameters should work like this:

  void func( explicit T arg ) { // ... }
  void funcB( explicit const T& arg ) { // ... }

should be equivilent to

  void func( T& arg_ ) { T arg( arg_ ); // ... }
  void funcB( T& arg_ ) { const T& arg( arg_ ); // ... }

where 'arg_' should be invisible inside the functions bodies '// ...'.
This should yield no surprises and shows that the compiler doesn't need
any new magic for 'explicit' here. It just hides a temporary (or creates
an unnamed temporary depending on your point of view) that can be
optimized away.

Regards, Daniel

----------------------------------------------
 aixigo AG - Financial Research and Education
 Schlo=DF-Rahe-Stra=DFe 15, 52072 Aachen, Germany
 Tel: +49 (0)241 936737-42           Fax: -99
 Daniel.Frey@aixigo.de   http://www.aixigo.de
-------------------- "wir machen Anleger" ----

---
[ 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.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



