[Development] Reverting the QRegExp change?

lars.knoll at nokia.com lars.knoll at nokia.com
Wed May 2 13:16:03 CEST 2012


On 5/2/12 11:57 AM, "ext Thiago Macieira" <thiago.macieira at intel.com>
wrote:

>On quarta-feira, 2 de maio de 2012 10.21.36, Giuseppe D'Angelo wrote:
>> In a related patch I suggested something like
>> 
>> int QRegExp::foo() const
>> {
>>   QRegExp copy = *this;
>>   return copy.foo();
>> }
>> 
>> which although being source compatible, is behaviour incompatible
>> (QRegExp users do expect const methods to change the object -- it's
>> even documented!).
>
>Indeed, so I think this is actually worse of the three options.

Agree.
>
>Reverting completely means we accept that QRegExp is fundamentally flawed
>and 
>people should port away from it immediately. I'd even tack a notice to
>the 
>class saying that its const methods are not thread-safe.

If it's used to port existing code over to Qt 5 it should be ok, as that
code worked with the flaw in Qt 4.x. It's actually a minor flaw, as you
usually would do some matching before calling the methods and these would
detach the regexp. After that the methods should be safe to access.

For new code people should anyways start to use QRegularExpression.

But yes, we should still add a warning in the docs.

Cheers,
Lars

>Adding Olivier's patch means we do a little work to improve code in an
>otherwise Done class, with the ability to keep the old code compiling if
>one 
>so wishes (with the same bugs, of course).

>Adding yours would mean silently changing behaviour. That's far worse.
>
>> So it's a matter of deciding what's the least worst option.
>
>-- 
>Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
>     Intel Sweden AB - Registration Number: 556189-6027
>     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
>_______________________________________________
>Development mailing list
>Development at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list