[Development] Deprecating QString::{v,}sprintf()

Marc Mutz marc.mutz at kdab.com
Tue Feb 21 10:33:12 CET 2012


On Tuesday February 21 2012, Marc Mutz wrote:
> Hi,
>
> The QString header contains a ### about removing sprintf() in 5.0, but it's
> still there. I'd like to deprecate them.
>
> I have a long-standing hate of the fact that QString::sprintf() is not
> static, so my preferred solution would be to make it static, but that
> silently breaks existing usage other than the idiomatic
> QString().sprintf().
>
> Unless there's a clever technique by which we can at compile-time catch
> non-static uses of sprintf(), I'd propose to just deprecate it.

Actually, I just found GNU's asprintf() extension ("allocated-string printf"), 
arguably a better name for QString::sprintf() anyway. So I'll upload a patch 
to Gerrit that will:

1. Deprecate QString{v,}sprintf()
2. Add static QString::{v,}asprintf()

Thanks,
Marc


-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4700 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120221/2af33b48/attachment.bin>


More information about the Development mailing list