🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1737

Re: Why no conversion of string to const char * in STD lib?

#1737
From: Ulf Schuenemann
Date: Fri, 18 Aug 1995 15:08
39 lines
2308 bytes
In article <VANDEVOD.95Aug16144504@avs.cs.rpi.edu>, vandevod@cs.rpi.edu (David Vandevoorde) writes:
[..]
|> The `explicit' keyword is currently only applicable to constructors,
|> not conversion operators. Do you think:
|> 
|> 	f(static_cast<char*>(s))
|> 
|> is more convenient than:
|> 
|> 	f(s.c_str())	?

Yes. I know, I want the string represented as something of type const char*,
so I call static_cast<const char*>. IMHO it's inconvienent to look up the
class to find that I need to call a method called c_str() to get a const char*.
Using methods for conversions results in _globally_ inconsistent naming schemes:
string uses c_str() other classes/libraries (eg myVector, mySet) may use
toString() or toCharptr() and other classes call it stringify() etc.


Ulf Schuenemann

--------------------------------------------------------------------
Ulf Schünemann
Fakultät für Informatik, Technische Universität München, Germany.
email: schuenem@informatik.tu-muenchen.de
WWW:   http://www.informatik.tu-muenchen.de/cgi-bin/nph-gateway/hphalle2/~schuenem/index.html

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <41237n$dme@sunsystem5.informatik.tu-muenchen.de>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <BASHFORD.95Aug1200815@toad.scripps.edu> <MATT.95Aug13161131@physics2.Berkeley.EDU> <MATT.95Aug16093212@physics2.Berkeley.EDU> <VANDEVOD.95Aug16144504@avs.cs.rpi.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: schuenem@informatik.tu-muenchen.de (Ulf Schuenemann)
Newsgroups: comp.std.c++
Subject: Re: Why no conversion of string to const char * in STD lib?
Date: 18 Aug 1995 15:08:13 GMT
Organization: Technische Universitaet Muenchen, Germany
Sender: USENET Newssystem <news@informatik.tu-muenchen.de>
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <41237n$dme@sunsystem5.informatik.tu-muenchen.de>
References: <BASHFORD.95Aug1200815@toad.scripps.edu>  <MATT.95Aug13161131@physics2.Berkeley.EDU>  <MATT.95Aug16093212@physics2.Berkeley.EDU> <VANDEVOD.95Aug16144504@avs.cs.rpi.edu>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: TEXT/PLAIN; charset="UNKNOWN-8BIT"
Content-Transfer-Encoding: QUOTED-PRINTABLE
X-Nntp-Posting-Host: hpbroy3.informatik.tu-muenchen.de
Originator: schuenem@hpbroy3.informatik.tu-muenchen.de
X-Lines: 35
Content-Length: 1101
Originator: clamage@taumet