Static access to ICore
Esben Mose Hansen
kde at mosehansen.dk
Fri Nov 16 20:03:43 UTC 2007
On Friday 16 November 2007 19:35:06 Andreas Pakulat wrote:
> Huh? Ok, the constructor check would help if one could directly create
> an ICore object, but the destructor check doesn't help with anything, if
> instance != it gets set to 0, if it already is 0, well nothing happens
> in the end.
Well, as I presume that only one instance is ever created, that check is
almost free and would catch the rather fatal bug if it was created twice.
Likewise with the destructor: While unlikely, the check is nearly free (could
be an assert, even) and is a nice sanity check. I admit I might be too
paranoid there. Blame my IT career ;)
> > I would further suggest that ICore
> > constructor/destructor is private but friends with the few classes that
> > actually need it.
> There's no way to create an ICore object, because its an abstract class.
> The I in ICore stands for "Interface" ;)
Ah. Well, that's not much of a concern, then.
> Oh and the subclass "Core" of ICore that does have a constructor can
> only be created by linking to a special KDevelop library, which is only
> allowed to happen from the main program (i.e. there's 1 call to Core()
> in main())
ok, so maybe I was too paranoid. All my alarm bells just went of when I saw
the code. No offense meant! (I would still add the constructor check, at
least as an assert) :p )
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the KDevelop-devel