New version of Panel Clock applet
Thiago Macieira
thiago.macieira at kdemail.net
Sun Jan 11 15:45:16 GMT 2004
Clarence Dang wrote:
>On Fri, 9 Jan 2004 08:03 am, Frerich Raabe wrote:
>> On Wed, Jan 07, 2004 at 09:12:49PM +0930, Kevin Gilbert wrote:
>> 4.) There are many little C++ style problems, ... passing constant
>> values to functions (I saw "void f(const double)" somewhere),
>
>Hmm, what's wrong with that?
Don't mistake the const *by-value* parameters with the const
*by-reference* ones. There's nothing wrong with the latter, but the
former is pretty much useless.
>IMHO it achieves 2 things:
>1. tells the reader of the code that you aren't going to modify the
> local copy of the argument
True, but in by-value parameters, the caller couldn't care less about
the local copy.
>As a bonus, you get interesting looking functions declarations like:
>
> int mystrlen (const char * const s);
'const char*' is ok, but '* const' is unnecessary. Imagine you need, in
future code, to do s++. If you had declared it '* const', you wouldn't
be able to. Nor with a 'const double'.
What's worse (and I can't confirm), it seems g++ drops the constness for
simple by-value parameters in the mangling of functions, so it's easy
for you to forget about the fact since it won't complain. However,
other compilers -- maybe other versions of g++ too -- don't, so you get
compilation errors quite easily.
There was one such recent problem in kopete-devel.
--
Thiago Macieira - Registered Linux user #65028
thiagom (AT) mail (dot) com
ICQ UIN: 1967141 PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040111/62a4fd3e/attachment.sig>
More information about the kde-core-devel
mailing list