From: Richard Chan <cshihpin@dso.org.sg>
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] g++-v3 and suspect C++ code in configtool
Date: Wed, 11 Jul 2001 19:41:00 -0000 [thread overview]
Message-ID: <20010712104710.A5167@cshihpin.dso.org.sg> (raw)
(I know 2.95.2 is the recommended version :-) but
let's live on the edge here...after all
if the C++ code is suspect but was passed by 2.95.2 shouldn't
it be cleaned up?)
g++ v3 does not like some of the C++ constructs in
configtool; are the following due to dubious C++ code or
a bad compiler? (BTW g++-v3 builds wxwindows 2.3.1 snapshot
and the demo programs run)
[Problem 1]
friend X or friend class X declarations
v3 is now fussy about "class" key-name - is this the behaviour expected
by the standard?
Compiling aboutdlg.cpp
In file included from /d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/ecpch.h:64,
from /d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/aboutdlg.cpp:50:
/d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/configtool.h:105: friend
declaration requires class-key, i.e. `friend class ecMainFrame'
make: *** [/d2/home/cshihpin/src/ecos-build/ct-build-release/aboutdlg.o] Error 1
Same problem in mainwin.h
[Problem 2]
operator overloading of + in w+e where w is a wxString and e is an ecFileName
completely blows g++.
Compiling configtool.cpp
/d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/configtool.cpp: In
member function `bool ecApp::PrepareEnvironment(bool, wxString*)':
/d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/configtool.cpp:927: choosing
`wxString operator+(const wxString&, const wxString&)' over `ecFileName
operator+(const ecFileName&, const ecFileName&)'
...many similar error messages deleted...
/d1/cvs/ecos/ecos/host/tools/configtool/standalone/wxwin/configtool.cpp:945:
because worst conversion for the former is better than worst conversion for
the latter
make: *** [/d2/home/cshihpin/src/ecos-build/ct-build-release/configtool.o] Error 1
This is the offending line
(* cmdLine) += wxString(wxT("export PATH=")) + strBinDir + wxT(":$PATH; ");
Here is a minimal C++ file that can trigger this overloading confusion.
Seems that it can't decide between
wxString operator+(const wxString&, const wxString&)
ecFileName operator+(const ecFileName&, const ecFileName&)
#include <wx/string.h>
#include <filename.h>
main()
{
wxString w;
ecFileName e;
w + e;
}
So if you have ClassA and ClassB derived from ClassA;
ClassA has operator+(const ClassA&, const ClassA&),
ClassB also has operator+(const ClassB&, const ClassB&)
ClassB has a constructor ClassB(ClassA)
Then if x is a ClassA and y is a ClassB what should be
called in the case of
x + y
i.e. operator+ from ClassA or from ClassB?
That's all for now.
Thanks
Richard Chan <cshihpin@dso.org.sg>
next reply other threads:[~2001-07-11 19:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-11 19:41 Richard Chan [this message]
2001-07-12 3:33 ` Julian Smart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010712104710.A5167@cshihpin.dso.org.sg \
--to=cshihpin@dso.org.sg \
--cc=ecos-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).