public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc 2.96 -wchar-stdc++ option in 3.2.3?
@ 2005-01-12  3:18 Mai-San_Chan
  2005-01-12  5:33 ` Ian Lance Taylor
  2005-01-17 18:50 ` gcc 2.96 -wchar-stdc++ option in 3.2.3? Jeffrey A Law
  0 siblings, 2 replies; 5+ messages in thread
From: Mai-San_Chan @ 2005-01-12  3:18 UTC (permalink / raw)
  To: gcc-help

What is the -wchar-stdc++ option in gcc 2.96?  I cannot find documentation
for this option in the online gcc manuals.  It is unrecognized by gcc
3.2.3.  What should be used in its place in 3.2.3?

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 2.96 -wchar-stdc++ option in 3.2.3?
  2005-01-12  3:18 gcc 2.96 -wchar-stdc++ option in 3.2.3? Mai-San_Chan
@ 2005-01-12  5:33 ` Ian Lance Taylor
  2005-01-12 12:18   ` Overloaded method resolution order Stuart Brooks
  2005-01-17 18:50 ` gcc 2.96 -wchar-stdc++ option in 3.2.3? Jeffrey A Law
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2005-01-12  5:33 UTC (permalink / raw)
  To: Mai-San_Chan; +Cc: gcc-help

Mai-San_Chan@peoplesoft.com writes:

> What is the -wchar-stdc++ option in gcc 2.96?  I cannot find documentation
> for this option in the online gcc manuals.  It is unrecognized by gcc
> 3.2.3.  What should be used in its place in 3.2.3?

There was never an official gcc 2.96 release.  The last official
release before 3.0 was 2.95.  There were various interim releases made
by various different people which got the name 2.96.

For example, I happen to have a system running Red Hat Linux 7.3 has a
gcc which claims to be 2.96.  However, that gcc doesn't appear support
the -wchar-stdc++ option either.

Poking around on the web, it looks like -wchar-stdc++ was a way to get
wide character support in libstdc++.  The libstdc++ code in 3.2.3 is
completely rewritten.  As far as I know it supports wide characters
(via std::wstring, etc.) by default, at least on systems which provide
the underlying libc support (e.g., wchar.h, wcslen(), etc.).  It is
possible that you no longer need the -wchar-stdc++ option at all.  If
you think that you do need it, can you explain what you need it for?

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Overloaded method resolution order
  2005-01-12  5:33 ` Ian Lance Taylor
@ 2005-01-12 12:18   ` Stuart Brooks
  2005-01-13 16:33     ` Nathan Sidwell
  0 siblings, 1 reply; 5+ messages in thread
From: Stuart Brooks @ 2005-01-12 12:18 UTC (permalink / raw)
  To: gcc-help

I have a little hassle with overloaded methods which share the same name
except for a const. The class looks like this:

class MyClass
{
public:
  const char* getString() const { return my_string; }

protected:
  char* getString() { return my_string; }

private:
  char* my_string;
};

MyClass c;
char* s1=c.getString();
const char* s2=c.getString();

Both of these cause an error because they resolve to the second getString
and say that it is protected (which it obviously is). The following class
works however :

class MyClass
{
public:
  const char* getString() const { return my_string; }
  char* getString() { return my_string; }
};

According to Stroustrup (7.4), certain criteria are tried in order, so as to
determine which matches the closest. I would have thought that, at least in
the case of s2 (above), the "const char* getString() const" method would
have been selected. I had also hoped that since the second one was
protected, it would use the first one instead in any case. Am I missing
something here?

Regards
 Stuart



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Overloaded method resolution order
  2005-01-12 12:18   ` Overloaded method resolution order Stuart Brooks
@ 2005-01-13 16:33     ` Nathan Sidwell
  0 siblings, 0 replies; 5+ messages in thread
From: Nathan Sidwell @ 2005-01-13 16:33 UTC (permalink / raw)
  To: Stuart Brooks; +Cc: gcc-help

Stuart Brooks wrote:

> According to Stroustrup (7.4), certain criteria are tried in order, so as to
> determine which matches the closest. I would have thought that, at least in
> the case of s2 (above), the "const char* getString() const" method would
> have been selected. I had also hoped that since the second one was
> protected, it would use the first one instead in any case. Am I missing
> something here?

yes.  G++'s behaviour is correct.  The non-const version
is selected because the object is non-constant.  therefore an exact
match is a better conversion than the qualification conversion (as the
latter contains the former).  Access is not considered until after overload
resolution.  That separation allows you to relax the access on
a member and not break an already working program.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 2.96 -wchar-stdc++ option in 3.2.3?
  2005-01-12  3:18 gcc 2.96 -wchar-stdc++ option in 3.2.3? Mai-San_Chan
  2005-01-12  5:33 ` Ian Lance Taylor
@ 2005-01-17 18:50 ` Jeffrey A Law
  1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey A Law @ 2005-01-17 18:50 UTC (permalink / raw)
  To: Mai-San_Chan; +Cc: gcc-help

On Tue, 2005-01-11 at 19:18 -0800, Mai-San_Chan@peoplesoft.com wrote:
> What is the -wchar-stdc++ option in gcc 2.96?
First, as I'm sure others will point out, there was no such thing as 
GCC 2.96 from the GCC project.  "gcc 2.96" most likely refers to the
compiler released by Red Hat for its Red Hat Linux 7.x series as
well as Advanced Server 2.1.

The version of the C++ runtime included with those compilers did not
initially support wide characters.  Due to customer requests, Red Hat
eventually enabled wide character support in the C++ runtime for
Advanced Server 2.1.

To ensure ABI compatibility with existing deployments wide character
support was not enabled by default -- hence the introduction of the
-wchar-stdc++ option.



>   I cannot find documentation
> for this option in the online gcc manuals.
-wchar-stdc++ was never an option in any version of GCC from the FSF.
It is a Red Hat-ism for Advanced Server 2.1 developers that needed
wide character support in the C++ environment.



>   It is unrecognized by gcc 3.2.3.  What should be used in its place in 3.2.3?
GCC 3.2's C++ runtime should automatically include wide character
support.  ie, there is no need for a special switch to enable/disable
wide character support in modern versions of GCC.

I hope this answers your questions,
Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-17 18:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-12  3:18 gcc 2.96 -wchar-stdc++ option in 3.2.3? Mai-San_Chan
2005-01-12  5:33 ` Ian Lance Taylor
2005-01-12 12:18   ` Overloaded method resolution order Stuart Brooks
2005-01-13 16:33     ` Nathan Sidwell
2005-01-17 18:50 ` gcc 2.96 -wchar-stdc++ option in 3.2.3? Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).