[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: passing POD by value with const qualifiers. Silly or not?
From: "Friedrich W. H. Kossebau" <kossebau () kde ! org>
Date: 2008-02-23 9:48:30
Message-ID: 200802231048.31181.kossebau () kde ! org
[Download RAW message or body]
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@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic