passing POD by value with const qualifiers. Silly or not?

Alexander Neundorf neundorf at kde.org
Wed Feb 20 17:44:21 GMT 2008


On Wednesday 20 February 2008, Matt Rogers wrote:
> Hi,
>
> So, I've been doing some review of decibel and I've seen some stuff like
> this (from kdereview/decibel/src/server/contactmanager.h)
>
> Decibel::ChannelInfo
> contactContactUsingAccount(const uint contact_id, const int account_handle,
>                            const int type, const bool suppress_handler);
>
>
> Most of us know that passing POD by value with a const qualifier is
> kinda silly, since it has next to zero real effect. 

You can't accidentially assign a different value to contact_id in the 
implementation. It doesn't change anything for the calling code. I don't see 
a problem here, so I'd say this is up to the maintainer.

Alex




More information about the kde-core-devel mailing list