[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: "Stefan Teleman" <stefan.teleman () gmail ! com>
Date: 2008-02-22 21:02:58
Message-ID: 1ccb59a20802221302q12649b01icfb0faeef486e0a2 () mail ! gmail ! com
[Download RAW message or body]
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 ... :-)
--
Stefan Teleman
KDE e.V.
stefan.teleman@gmail.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic