   Restrain the wild pointer
  Hi there,I am recently working on an existing software project where the pointers and conversions are used widely. The existing integrity check failed to provide adequate protection so the pointer did not always stay in "safe zone".I read an article related to this issue, and it is very good.http://www.gamedev.net/reference/articles/article2009.aspI am just wondering if anybody else can provide more tips and programming practise to use the pointer safer, while still powerful.Could you provide more inputs? Thank you in advance.Johnson   
  The simplest rule is just "do not use raw pointers at all".If you consistently use iterators, iterator ranges, smart pointers, opaque handlers etc instead of raw T* pointers -- it would be really hard to make an accidental mistake in the code.The only T* pointer I would allow in user code is this pointer.And it was better to be a reference :)   ;  Const-correctness can help.Don't just use pointers to constants (const Type *instance), but also use constant pointers (Type* const instance) and constant pointers to constants (const Type* const instance)--when appropriate, of course.