[Qt-creator] RunMode in Analyzer plugin
andre.poenitz at mathematik.tu-chemnitz.de
Sun Jan 15 11:46:42 CET 2012
On Fri, Jan 13, 2012 at 10:14:03PM +0100, Nicolas Arnaud-Cormos wrote:
> Since commit a6ff74c0, the run mode changes from a string to an enum.
> Unfortunatelly, it means there's no way to add a new mode (except by changing
> the code): no way to create any new analyzer 3rd party plugin.
Sure. Pick a random integer and be done. There's a chance of clashs,
but there also a chance of clashs when using random strings, even if
it's smaller, the harm is done.
If the clashs are a _real_ issue we should probably device a method
to assign an range of integers to a plugin that can be "safely" used
as "id" in any creator "id" context. Qt used to have something for
Qxxx suffixes and I am not aware of a case where this was a problem.
> I see two possible solutions:
> * revert the commit
> * use int instead of the enum in the different methods, and add a
> * UserMode in the enum
I went for an enum because it shows its name in the debugger. You can
cast an int to an enum if you want, so this is not a restriction.
We could indeed add a 'UserMode' style value, though, to keep some
room for 'official' values.
> What's wrong with the string?
Last time I checked we spend around 8% on string related code on startup
where there shouldn't be that much. Part of it was due to some
utf16->utf16 (sic!) conversion but there's still a measurable part due
to using strings as ids all over the place.
Creator is growing quickly, we need to be cautious when it comes to
selecting "convenient" approaches that have consequences for performance
> we can use a QByteArray in this case.
Yes, that would take away part of the pain, but still need a allocation
and quite a bit more code than an int or enum.
More information about the Qt-creator