[Development] Regular expression libraries for QRegExp

Thiago Macieira thiago.macieira at intel.com
Fri Nov 25 00:24:21 CET 2011


On Thursday, 24 de November de 2011 23:49:02 Oswald Buddenhagen wrote:
> On Wed, Nov 23, 2011 at 03:35:57PM +0100, ext Thiago Macieira wrote:
> > At first thought, I'd say that the pattern class should be a regular,
> > implicitly-shared, atomic copy-on-write value class. If you call a
> > non-const method, it detaches.
> > 
> > There should be no const methods that modify internal caches. Period. If
> > you compile the pattern, it's a non-const method and it detaches.
> 
> that makes lazy compilation really tough to implement ...

Yes and no. Lazy compilation of the pattern is tough to implement, but it's 
not because of what I said above. The reason why it's tough is also the reason 
why I said what I said above:

You cannot const_cast a shared object without either: atomically detaching or 
locking a mutex. If you have a mutex because of the lazy initialisation / 
compilation, then you don't need atomic reference counting and detaching. A 
single int, protected by the mutex, would be enough.

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111125/71a68bed/attachment.sig>


More information about the Development mailing list