A New Krazy Checker for Methods Returning const refs

Allen Winter winter at kde.org
Mon Apr 16 13:38:56 BST 2007


On Monday 16 April 2007 7:04:10 am Thiago Macieira wrote:

> 
> Anyways, if a developer clearly needs to break the rule because the API
> and/or implementation would be better returning a const-ref, I don't see
> why he couldn't. There are exceptions to every rule. He should only
> clearly understand the issues.
> 

Here's how to tell Krazy to make an exception:

1. if you want Krazy to exclude this check for your entire subdir (eg, kdesupport/strigi)
     create a .krazy file in that subdir with the line
         EXCLUDE constref

2. if you want Krazy to exclude this check forinstalled header foo.h, then
     put this comment someplace in foo.h
        //krazy:excludeall=constref

3. if you want Krazy to exclude this check for method fooMethod(), then 
    put this comment at the end of the fooMethod() delcaration
       //krazy:exclude=constref

       eg.  const QStringList &Foo::fooMethod() const();  //krazy:exclude=constref





More information about the kde-core-devel mailing list