0

I was writing experimental code in an attempt to deepen my understanding of C++ operators, and came across the following example which prints 0 (false) and exits.

bool doSomething() {
    return false;
}

int main() {
    std::cout << (********doSomething)() << std::endl;
    return 0;
}

Is this behaviour covered by the standard? If so, how is it we can dereference a pointer eight times and still get the same pointer?

JeremiahB
  • 896
  • 8
  • 15
  • function pointer are special, a pointer to a function pointer is treating like a function pointer, so *fp === fp, thus **fp === *(*fp) === *(fp) === fp – pm100 Mar 07 '17 at 17:24
  • http://stackoverflow.com/questions/42165003/which-of-the-following-function-invocations-is-valid – pm100 Mar 07 '17 at 17:27

0 Answers0