[Development] Using '#pragma once' instead of include guards?

Ulf Hermann ulf.hermann at qt.io
Fri Nov 4 15:29:25 CET 2022


> Once we had QString and QByteArray (and the admittedly ill-conceived
> QStringRef). Now we have QStringView, QAnyStringView, QByteArrayView,
> ... and when asking what the prefered getter/setter-signature for
> "Qt-style" interfaces is the answer I get is "We'd guess $X, but the
> only guy that knows for sure is on holiday". And that's for "developers
> using Qt", not "developers _of_ Qt". Is that something you'd
> call "complicated"?

While I can sympathize with the idea of #pragma once, this is not a fair 
comparison. The current set of classes, while complicated, also does a 
lot more than what we previously had. If you want the only the old 
functionality you can just restrict yourself to QString, QByteArray, and 
QStringView. That's not actually more complicated.

But if you want classes that deal with UTF-8 and with views on different 
kinds of string data, you obviously need some more types.


More information about the Development mailing list