From: Ben v. K. <be...@vi...> - 2004-12-19 01:21:30
|
Sorry I didn't outline this before, I was in a bit of a rush. Here's the idea: For debugging purposes, I was going to superclass each CLucene class. When an object is initialised (in debug mode), it would add a file/line reference and pointer to a global collection. When the object is destroyed, the data is removed from the collection. At the end of execution, the data can be printed out to the stdout, or to a file. Fairly simple to implement, and i think it would help a lot of people in debugging. So I thought it would be easy, do something like this: #define LUCENE_CLASS(x) class x: public IPointerTracker<x> LUCENE_CLASS(Document) { ... }; However, the intelisense (code completion) in MS Visual Studio, doesn't work after doing this. So I tried this: #define LUCENE_CLASS(x) public IPointerTracker<x> class Document : LUCENE_CLASS(Document){ ... }; but then, if the define for LUCENE_CLASS is disabled in non-debug mode, then compiling will fail. so i thought perhaps it would be ok to do this #ifdef _DEBUG #define LUCENE_CLASS(x) public IPointerTracker<x> #else #define LUCENE_CLASS(x) public virtual IEmptyInterface #endif class Document :LUCENE_CLASS(Document){ ... }; So in the non-debug mode, an empty virtual class is used, but no code in it. My question is, will this take a performance hit? I wouldn't think so, since the superclass is virtual and there just as an interface. ben John Wheeler wrote: >What is the superclass going to do? > >Regards, > >John > > >On Sat, 18 Dec 2004 19:22:37 +1000, Ben van Klinken ><be...@vi...> wrote: > >>Hi Everyone, >> >>I was just wondering if anyone had any experience with c++ intrinsics. >>Particularly, does anyone know whether a class that implements an interface >>will take a performance hit in comparison to the same class that does not. >> >>I am implementing some debug code where every class needs to be super-classed >>(only in debug mode though). However, to do that using macros means that MS >>Visual Studio will lose its intelisense (code completion) ability. So I thought >>that if all classes implement an empty interface, this would be an easy way of >>solving the problem. >> >>Any ideas/thoughts? >> >>cheers, >>Ben >> >>------------------------------------------------------- >>SF email is sponsored by - The IT Product Guide >>Read honest & candid reviews on hundreds of IT Products from real users. >>Discover which products truly live up to the hype. Start reading now. >>http://productguide.itmanagersjournal.com/ >>_______________________________________________ >>CLucene-developers mailing list >>CLu...@li... >>https://lists.sourceforge.net/lists/listinfo/clucene-developers >> > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://productguide.itmanagersjournal.com/ >_______________________________________________ >CLucene-developers mailing list >CLu...@li... >https://lists.sourceforge.net/lists/listinfo/clucene-developers > > > |