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) {
I agree with all the other answers provided, but here's one more way of handling that, which to me personally looks more explicit, if more verbose:
void fun() { // Handle no pointer passed } void fun(const char* ptr) { // Handle non-nullptr and nullptr separately }