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

Stefan Teleman stefan.teleman at
Fri Feb 22 16:23:26 GMT 2008

On Fri, Feb 22, 2008 at 8:28 AM, André Wöbbeking <Woebbeking at> wrote:

>  Did you try it? According to the C++ standard e.g.
>  void foo(int);
>  void foo(const int);
>  are equivalent.

Tried it and dealt with it many many times.


Overloadable declarations

[ ... ] const and volatile type-specifiers buried within a parameter
type specification are significant and can be used to distinguish
overloaded function declarations. [ ... ]

One could argue that overloading on the const or volatile type
specifier was intended for pointer or reference types only [hi,
comp.std.c++.moderated!], but Sun Studio has enforced the overloading
distinction between void foo(int) and void foo(const int) since i can

The question still remains (in my mind): why is void foo(const int)
useful ? It's not like there are any amazing assembler optimizations
possible when saying void foo(const int) as opposed to just void


Stefan Teleman
KDE e.V.
stefan.teleman at

More information about the kde-core-devel mailing list