🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #796

libg++ 2.7.0 String.h ambiguities

#796
From: GORDON_KEI
Date: Mon, 23 Oct 1995 03:25
35 lines
1367 bytes
Question about libg++ 2.7.0 String.h

The program:

#include <String.h>
#include <iostream.h>

main() {
  String a = "string";
  String b = "abc";

  cout << a.from(b.length());
}

generates the following compiler errors:

junk2.cc: In function `int main()':
junk2.cc:8: call of overloaded method `from(unsigned int)' is ambiguous
/usr/local/lib/g++-include/String.h:277: candidates are: String::from(const String &, int)
/usr/local/lib/g++-include/String.h:276:                 String::from(int)
/usr/local/lib/g++-include/String.h:280:                 String::from(char, int)

I personally feel that the return from length() should be usable in from()
without the need for type casting. I'm not very familiar with c++, so I'm not
sure if this a funny in the standards or a bug in libg++, or just 
unreasonable expectations on my part.

Any comments?

Gordon Keith

gordon_kei@antdiv.gov.au
Programmer
Marine Science Section
Australian Antarctic Division 
Technical Details
Message-ID: <951023092721.20411a5c@antdiv.gov.au>
Path: arc1-ca.pugleaf.net!antdiv.gov.au!GORDON_KEI

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!antdiv.gov.au!GORDON_KEI
From: GORDON_KEI@antdiv.gov.au
Newsgroups: gnu.g++.help,comp.lang.c++
Subject: libg++ 2.7.0 String.h ambiguities
Date: 22 Oct 1995 23:25:54 -0400
Organization: Gatewayed from the GNU Project mailing list help-g++@prep.ai.mit.edu
Sender: daemon@cis.ohio-state.edu
Distribution: world
Message-ID: <951023092721.20411a5c@antdiv.gov.au>