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

André Wöbbeking Woebbeking at kde.org
Fri Feb 22 13:28:42 GMT 2008


On Wednesday 20 February 2008, Stefan Teleman wrote:
> On Feb 20, 2008 2:25 AM, Andre Wöbbeking <Woebbeking at kde.org> wrote:
> > 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).
>
> In this case, strictly conforming compilers will generate an
> undefined symbol at link time because of argument constness mismatch
> between the declaration and the implementation. It's neither BC nor
> BIC, it just won't link.

Did you try it? According to the C++ standard e.g.

void foo(int);
void foo(const int);

are equivalent.

But we still support non standard compliant compilers :-( So we should 
probably don't use this feature.


Cheers,
André




More information about the kde-core-devel mailing list