Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5 Alpha
-
None
-
n/a
Description
Pointer Improvements
--------------------
I would like the following pointer improvements. This is mainly to do with ensuring that a pointer will always be valid if it is not NULL.
Rule1
=====
On creation, unless a pointer is assigned a value it must be set to NULL.
example:
Test * pTest = NULL;
or
Test * pTest = new Test();
Rule2
=====
Before using a pointer, it is tested to check that it is not NULL.
example:
if( pTest != NULL)
{
bool bResult = pTest->method1( iValue);
}
or
if( pTest != NULL)
{
bool bResult = pTest->method1( iValue);
if( bResult == true)
{ pTest->method2( sValue); }}
Rule3
=====
On deletion, the pointer is set to NULL.
example:
if( pTest != NULL)
{
delete pTest;
pTest = NULL;
}
Can we use a set of globle macros for this?