for example consider this single factorial:
int factorial(int number) {
int temp;
if(number <= 1) return 1;
temp = number * __FUNCTION__(number - 1);
return temp;
}
It gives:
error: '__FUNCTION__' cannot be used as a function
The idea is using this constant instead of function name so if I change the name of the function it wouldn’t be needed to look in the rest of the code to update the name wherever function calls itself.
You can’t because
__FUNCTION__is probably reserved by the implementation, and it expands to the function name (in string format).Besides changing the name, you might want to use a macro instead of a constant:
Personally, I don’t see the point of this. Granted, you only change the function name in one place, but is it worth it?