[Development] QValidator in QtCore
Olivier Goffart
olivier at woboq.com
Mon Sep 23 16:36:43 CEST 2013
On Monday 23 September 2013 15:06:26 Konrad Rosenbaum wrote:
> Hi,
>
> On Monday 23 September 2013 09:45:51 Olivier Goffart wrote:
> > On Sunday 22 September 2013 16:25:25 Thiago Macieira wrote:
> > > Right now, we allow them and I don't like the idea of forbidding forward
> > > declarations.
> > >
> > > Therefore, doing anything that breaks them is source-incompatible and
> > > should not be permitted until Qt 6.
> >
> > Yes, but as stated, using macro as it was done for QXmlStreamWriter does
> > not break source or binary compatibility. Hence it is possible to move a
> > class from one module to a lower module.
>
> I beg to differ!
>
> --snip: header--
> class QXmlStreamWriter;
>
> class MyClass
> {
> public:
> MyClass();
> //...etc.
> private:
> QXmlStreamWriter*m_output;
> };
> --snap: source--
> #include <QXmlStreamWriter>
>
> MyClass::MyClass()
>
> :m_output(new QXmlStreamWriter)
>
> {}
> --the end--
>
> Before the change: the code worked as expected.
>
> After the change: it does not compile because the forward-declaration
> declares a different class than what should have been used and the compiler
> fails with incompatible pointers.
Ah Right. I was wrong.
Because the compiler do not see the #define in the .h file.
> I do this all the time to speed up my compiler. (You start to notice the
> compiler once you have more than just a couple of C++ files and you are
> limited to a small share of an already underperforming machine.)
Yes.
The solution would have to have forward declaration header that forward
declares all the classes.
Then we would forbid forward declaration of Qt classes.
Let a few versions for users to adapt.
And then we can allow changes that break forward declaration.
> In other words: broken source compatibility. Period.
> Whenever that happens a certain Teutonic programmer forgets that little
> invention called "civilization", grabs his battle hammer and screams bloody
> murder...
--
Olivier
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
More information about the Development
mailing list