extragear/multimedia/amarok/src

Soren Harward stharward at gmail.com
Thu Oct 23 03:40:25 CEST 2008


On Wednesday 22 October 2008 21:21:54 Jeff Mitchell wrote:
> Ian Monroe wrote:
> > It makes 0 sense for a return type to be const. Return types are
> > copies. So the const there is just ignored, thus the warning. The
> > const is misleading.
>
> No, it's not ignored...trying to modify the object without const casting
> it will result in a compile error.
>
> For that reason, it's not misleading either.  The const is a warning to
> the caller that they should not be modifying that object, and since the
> compiler will force this upon them, it's far from misleading; it's very
> direct and specific.

In addition to the explanations provided by Jeff, I highly recommend that anyone 
who's following this thread review the "Const Correctness" section of the C++ 
FAQ Lite:

http://www.parashift.com/c++-faq-lite/const-correctness.html

This will probably answer most of the questions, and correct most of the 
misunderstandings, that are likely to pop up if this thread continues.

-- 
Soren Harward
stharward at gmail.com


More information about the Amarok-devel mailing list