error checking in c++

Milian Wolff mail at milianw.de
Thu Jun 2 20:01:00 UTC 2011


Hey all,

I'm a bit suprised at how 'forgiving' the c++ parser and duchain stuff is. 
There are tons of cases where invalid C++ code is accepted without any errors 
being shown to the user.

One funny case I just spotted:

#include <math.h>
class foo {
  virtual void bar() = M_PI;
}

;-)

The parser accepts lots of expressions there, not only = 0 (and now = Delete 
etc.). As far as I can see the reason is mainly code-reuse, as the same 
ASTNode is used in e.g. a function context.

From a parser for an editor pov this is actually a good thing as we don't trip 
over it and die.

Yet personally I still think problems should be reported to the user. Why is 
this not done yet? Lack of man power or due to - potential - performance 
issues? I'd rather have kdevelop take a few seconds more in parsing than 
having to run gcc to spot the issue later on...

What are your opinions on this?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110602/be9a45af/attachment.sig>


More information about the KDevelop-devel mailing list