passing POD by value with const qualifiers. Silly or not?
Friedrich W. H. Kossebau
kossebau at kde.org
Sat Feb 23 09:48:30 GMT 2008
Am Freitag, 22. Februar 2008, um 22:02 Uhr, schrieb Stefan Teleman:
> On Fri, Feb 22, 2008 at 3:50 PM, Ingo Klöcker <kloecker at kde.org> wrote:
> > This is a pretty stupid example, but nevertheless it should illustrate
> > why it might be nice to put a const before a function argument:
> >
> > void f( const int x )
> > {
> > if ( x = -1 ) {
> > return;
> > } else {
> > print( x );
> > }
> > }
>
> if (-1 = x) {
>
> // ...
>
> And, thusly, you don't need const to avoid this one ... :-)
So what about non-static comparators, e.g. with
if (mX = x) ...
:)
Friedrich
More information about the kde-core-devel
mailing list