24-01-2017, 10:13 AM
Whilst agreeing with dg1980, an alternative approach if you know you do not want to include any of the C headers that include the NULL definition is to add the #define NULL 0 declaration yourself (making any required deviations necessary for use of #define other than as a guard)
The aim is to try and make it clear to the programmer (and particularly any subsequent maintainers) the difference between a value that is a pointer and an integer, hence not allowing pointer = 0;
The aim is to try and make it clear to the programmer (and particularly any subsequent maintainers) the difference between a value that is a pointer and an integer, hence not allowing pointer = 0;
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group