On Thu, 20 Dec 2012 22:22:01 +0100 Andreas Volz <[email protected]> said:

> Am Thu, 20 Dec 2012 14:29:36 +0900 schrieb Carsten Haitzler (The
> Rasterman):
> 
> > On Thu, 20 Dec 2012 00:04:33 -0200 Lucas De Marchi
> > <[email protected]> said:
> > 
> > > On Wed, Dec 19, 2012 at 7:24 PM, Andreas Volz <[email protected]>
> > > wrote:
> > > > Hello,
> > > >
> > > > Times ago I wrote some Eflxx Evas Canvas wrapper. There are those
> > > > functions in Canvas.cpp/.h:
> > > >
> > > > Canvas *Canvas::wrap (Evas_Object *o)
> > > > {
> > > >   return new Canvas (evas_object_evas_get (o));
> > > > }
> > > >
> > > > Canvas *Canvas::wrap (Evas *evas)
> > > > {
> > > >   return new Canvas (evas);
> > > > }
> > > >
> > > > One time it stopped compiling on Ubuntu Precise and as workaround
> > > > I just commented out the second wrap() function.
> > > >
> > > > Then I noticed the launchpad precise build job fails in ecorexx
> > > > with the same source it local compiles:
> > > >
> > > > https://launchpadlibrarian.net/125311410/buildlog_ubuntu-precise-amd64.ecorexx_0.1-0~201212100108~precise1_FAILEDTOBUILD.txt.gz
> > > >
> > > > EvasWindowFB.cpp: In constructor
> > > > 'Ecorexx::EvasWindowFB::EvasWindowFB(const Eflxx::Size&, const
> > > > char*, int)': EvasWindowFB.cpp:73:56: error: no matching function
> > > > for call to 'Evasxx::Canvas::wrap(Evas*)' EvasWindowFB.cpp:73:56:
> > > > note: candidate is: /usr/include/evasxx/Canvas.h:82:18: note:
> > > > static Evasxx::Canvas*
> > > > Evasxx::Canvas::wrap(Evas_Object*) /usr/include/evasxx/Canvas.h:82:18:
> > > > note:   no known conversion for argument 1 from 'Evas* {aka
> > > > _Evas*}' to 'Evas_Object* {aka _Evas_Object*}'
> > > >
> > > > Strange! Then I uncomment the second wrap function and local get
> > > > this error:
> > > >
> > > > In file included from Canvas.cpp:6:0:
> > > > ../include/evasxx/Canvas.h:94:18: error: 'static Evasxx::Canvas*
> > > > Evasxx::Canvas::wrap(Evas*)' cannot be
> > > > overloaded ../include/evasxx/Canvas.h:82:18: error: with 'static
> > > > Evasxx::Canvas* Evasxx::Canvas::wrap(Evas_Object*)'
> > > > Canvas.cpp:178:9: error: redefinition of 'static Evasxx::Canvas*
> > > > Evasxx::Canvas::wrap(Evas*)' Canvas.cpp:173:9: error: 'static
> > > > Evasxx::Canvas* Evasxx::Canvas::wrap (Evas_Object*)' previously
> > > > defined here make[2]: *** [Canvas.lo] Fehler 1
> > > >
> > > > Why does the compiler detect Evas* as redefinition of Evas_Object*
> > > > parameter? Did something change?
> > > >
> > > > Why couldn't I overload it? I may simply change wrap() to
> > > > wrapEvas() or so, but I really like to understand it.
> > > 
> > > See Evas.h, now they are both a typedef to Eo. For me this is an API
> > > break, but it doesn't seem to be for others...
> > 
> > it's not an api break imho.
> 
> Hm, why does then my code not longer compile if this is no API
> change? :-P

because you use this c++ thing and try and make c++ objects out of efl. :) from
a c perspective what we are doing is just fine. that's the point of a typedef -
so we can re-typedef it to something else. if we change it so the type is a
different size... then we keep api but broke abi...

if something relies on what something is typedeffed to - then it's a bug in
that thing. :) (in the general sense. we can debate this for days on end) :)
your code is relying on overloading wrap() so you can make multiple versions of
it via param type (wrap(Evas *) vs wrap (Evas_Object *) vs wrap(Ecore_Timer *)
etc.) and from the c api level we still provide all of these types... BUT...
your code relies on what they map to to be also totally unique... it's
dereferencing the typedef (well c++ is) and that is your problem.

webkit does nasty things too.. they re-create all the typedefs in their own
code and our changes now break their code. they relied on what it was
typedeffed to and copy & pasted that.

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [email protected]


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to