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

Andre Wöbbeking Woebbeking at kde.org
Wed Feb 20 07:25:14 GMT 2008


On Wednesday 20 February 2008 06:04:24 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. 

It makes sense in the implementation but not in the API. As compromise we 
could remove the const in the header files but leave them in the source files 
(that is allowed for PODs).


Cheers,
Andre




More information about the kde-core-devel mailing list