Methods hiding others
Aside from other warnings, I've spotted some of these. Given that they are around the path effects, there might be something to them.
./live_effects/effect.h:99: warning: 'virtual NArtBpath* Inkscape::LivePathEffect::Effect::doEffect(NArtBpath*)' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)' ./live_effects/effect.h:101: warning: 'virtual std::vector<Geom::Path, std::allocatorGeom::Path > Inkscape::LivePathEffect::Effect::doEffect(std::vector<Geom::Path, std::allocatorGeom::Path >&)\ ' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)' ./live_effects/effect.h:103: warning: 'virtual Geom::Piecewise<Geom::D2Geom::SBasis > Inkscape::LivePathEffect::Effect::doEffect (Geom::Piecewise<Geom::D2Geom::SBasis >&)' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)'
I don't see these warnings (windows).
Anybody know what these warnings mean/are caused by?
The methods that are hidden are only called from one place in the code. LPESlant defines a new virtual doEffect that normally would call the first hidden method, that calls the 2nd hidden method etc. Perhaps that is what it means? (override doEffect1, so doEffect2 is never called for this class so hide it, which means doEffect3 is never called for this class so hide it, etc.)
Given that they are around the path effects, there might be something to them.
Have you found LPE bugs? Please let me know!
Johan
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Jon A. Cruz Sent: donderdag 8 november 2007 8:08 To: Inkscape Devel List Subject: [Inkscape-devel] Methods hiding others
Aside from other warnings, I've spotted some of these. Given that they are around the path effects, there might be something to them.
./live_effects/effect.h:99: warning: 'virtual NArtBpath* Inkscape::LivePathEffect::Effect::doEffect(NArtBpath*)' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)' ./live_effects/effect.h:101: warning: 'virtual std::vector<Geom::Path, std::allocatorGeom::Path > Inkscape::LivePathEffect::Effect::doEffect(std::vector<Geom::Path, std::allocatorGeom::Path >&)\ ' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)' ./live_effects/effect.h:103: warning: 'virtual Geom::Piecewise<Geom::D2Geom::SBasis > Inkscape::LivePathEffect::Effect::doEffect (Geom::Piecewise<Geom::D2Geom::SBasis >&)' was hidden ./live_effects/lpe-slant.h:27: warning: by 'virtual void Inkscape::LivePathEffect::LPESlant::doEffect(SPCurve*)'
This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Thu, 8 Nov 2007 10:46:21 +0100 J.B.C.Engelen@...1578... kirjoitti:
Anybody know what these warnings mean/are caused by?
The methods that are hidden are only called from one place in the code. LPESlant defines a new virtual doEffect that normally would call the first hidden method, that calls the 2nd hidden method etc. Perhaps that is what it means? (override doEffect1, so doEffect2 is never called for this class so hide it, which means doEffect3 is never called for this class so hide it, etc.)
There's a good explanation for this warning here: http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9
So basically, when a base class has overloaded functions, the derrived class must define ALL overloaded functions or else you get a warning??
I tried to make a fix, but since I do not get the warning (what flags should we add to build.xml?), can somebody test whether it has worked?
Thanks, Johan
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Niko Kiirala Sent: donderdag 8 november 2007 11:17 To: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Methods hiding others
Thu, 8 Nov 2007 10:46:21 +0100 J.B.C.Engelen@...1578... kirjoitti:
Anybody know what these warnings mean/are caused by?
The methods that are hidden are only called from one place in the code. LPESlant defines a new virtual doEffect that normally
would call
the first hidden method, that calls the 2nd hidden method etc. Perhaps that is what it means? (override doEffect1, so doEffect2 is never called for this class so hide it, which means
doEffect3 is never
called for this class so hide it, etc.)
There's a good explanation for this warning here: http://www.parashift.com/c++-faq-lite/strange-inheritance.html #faq-23.9
-- Niko Kiirala niko@...1267...
This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On Nov 8, 2007, at 2:39 AM, J.B.C.Engelen@...1578... wrote:
So basically, when a base class has overloaded functions, the derrived class must define ALL overloaded functions or else you get a warning??
I tried to make a fix, but since I do not get the warning (what flags should we add to build.xml?), can somebody test whether it has worked?
I think the main factor is overriding *some* methods with the same name. "With the same name" is the key part.
I'd not looked to closely, but some cases of this are from signatures not matching completely. I believe one odd case I've fixed had a const mismatch where one of the base/subclass methods was declared a const method and the other was not.
The other really bad case is when you pick a name for something new in your subclass that was already used in a parent class. Then you get the same name, but used for different purposes. Very confusing.
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Jon A. Cruz Sent: donderdag 8 november 2007 18:43 To: Engelen, J.B.C. (Johan) Cc: inkscape-devel@lists.sourceforge.net; niko@...1267... Subject: Re: [Inkscape-devel] Methods hiding others
I think the main factor is overriding *some* methods with the same name. "With the same name" is the key part.
As I understand from the faq: Overriding a method with the same name is okay, as long as that function was not overloaded in the base class. If it IS overloaded, it will *not* be overloaded for the derrived class, i.e. all calls will go to the derived class' function. So if you have function overloading (as "conveniently" done in LPE), you must override all overloaded functions.
I'd not looked to closely, but some cases of this are from signatures not matching completely. I believe one odd case I've fixed had a const mismatch where one of the base/subclass methods was declared a const method and the other was not.
The other really bad case is when you pick a name for something new in your subclass that was already used in a parent class. Then you get the same name, but used for different purposes. Very confusing.
I'm certain that I did not do that (if I did I must have been sleeping), because indeed that is very very confusing and error prone. :)
But, did my change to LPESlant work? Is the warning gone for LPESlant?
Johan
J.B.C.Engelen@...1578... wrote:
But, did my change to LPESlant work? Is the warning gone for LPESlant?
As of rev #16449 it seems that the warnings are gone for lpe-slant.h. But I still see a couple of other ones. I'll send you a copy of my compiling output off-list for investigation.
Max
After reading 23.3 on the c++-faq-lite, I will change LPE things to the "Public Overloaded Non-Virtuals Call Protected Non-Overloaded Virtuals idiom" :-)
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Niko Kiirala Sent: donderdag 8 november 2007 11:17 To: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Methods hiding others
Thu, 8 Nov 2007 10:46:21 +0100 J.B.C.Engelen@...1578... kirjoitti:
Anybody know what these warnings mean/are caused by?
The methods that are hidden are only called from one place in the code. LPESlant defines a new virtual doEffect that normally
would call
the first hidden method, that calls the 2nd hidden method etc. Perhaps that is what it means? (override doEffect1, so doEffect2 is never called for this class so hide it, which means
doEffect3 is never
called for this class so hide it, etc.)
There's a good explanation for this warning here: http://www.parashift.com/c++-faq-lite/strange-inheritance.html #faq-23.9
-- Niko Kiirala niko@...1267...
This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (4)
-
unknown@example.com
-
Jon A. Cruz
-
Maximilian Albert
-
Niko Kiirala