Suppose I have this code. Your basic \"if the caller doesn\'t provide a value, calculate value\" scenario.
void fun(const char* ptr = NULL)
{
if (ptr==NULL) {
Depending on your platform, a pointer is likely either a 32 or 64-bit value.
In those cases, consider using:
0xFFFFFFFF or 0xFFFFFFFFFFFFFFFF
But I think the bigger question is, "How can NULL be passed as a valid parameter?"
I'd recommend instead having another parameter:
void fun(bool isValidPtr, const char* ptr = NULL)
or maybe:
void fun( /*enum*/ ptrState, const char* ptr = NULL)