[Development] Recommended way to take in strings
Thiago Macieira
thiago.macieira at intel.com
Wed May 31 16:05:29 CEST 2023
On Wednesday, 31 May 2023 00:17:21 PDT Marc Mutz via Development wrote:
> I doubt there's an accepted project-wide standard, yet, but as a rule of
> thumb that everyone might be able to agree on: If the function doesn't
> store the string as-is (=parses or pre-processes it), take by
> QAnyStringView, otherwise continue to take by QString cref.
I want to be very clear on that: the function's *purpose* must be to parse the
string in question and act on it immediately. It shouldn't be about what the
implementation is currently, but about what the function is.
It can't be a setter either (because there would be a getter). Therefore, if
your function isn't named after a verb in the imperative, then it should be
const QString &.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230531/3a8c13b0/attachment.bin>
More information about the Development
mailing list