Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-debug-dev] Idle thoughts on NPE and debugging outside a CDT project


Øyvind Harboe wrote:
It occurs to me that CDT has a lot of if() checks on null pointers, e.g.
whether or not a project exists.
Would it be possible and desireable to replace the null pointer concept
with an EmptyProject object?

EmptyProject would implement the approperiate interface(s) ICProject(?)
+ IProject (?) and implement non-poisonous responses.

Not possible, these interfaces are not intended to be implemented by clients.

Similar problems exists in more than one place, e.g. CDT makes the
false  assumption that an executable exists for a debug session.

These assumptions will be removed soon, though I don't recall if this was going to make it into 2.1.


I think if a method is documented as returning null or accepting null you must check for null, simply creating empty interfaces which do nothing is not going to solve the problem, it would just push the bug further down the chain or worse hide a bug which causes some change in behavior instead of a crash (can be much harder to debug).



Back to the top