Review Request: kdesupport/cpptoxml krazy fixes: Check for C++ operators that should be 'const'.

Thiago Macieira thiago at kde.org
Mon Mar 29 18:15:48 BST 2010


Em Segunda-feira 29 Março 2010, às 17:59:49, alex.richardson at gmx.de escreveu:
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/3423/#review4737
> -----------------------------------------------------------
> 
> 
> I don't see the point of declaring the return type const. IMO the method
> itself should be declared as const.

Don't make primitive return types const, since that causes warnings with GCC.

Non-POD types, it may make sense to avoid having people use it for something 
that discards changes. E.g.

	// the functions return QDateTime, and QString
	QDateTime dt = getSomeDate().addDays(30);
	QString s = getSomeString().append(" World");
	getSomeString().push_back(" World");

Without "const", all three compile. Two of them are useful, one is useless 
(which one?).

With const, only one compiles (can you tell which?). Of the two that don't 
compile, one would be useful to have compiling.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- 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://mail.kde.org/pipermail/kde-core-devel/attachments/20100329/ac3bad4b/attachment.sig>


More information about the kde-core-devel mailing list