C++Guns – RoboBlog

24.04.2015

return void func call (Pseudo Bug of the day 3)

Filed under: Allgemein — Tags: — Thomas @ 08:04

Heute gefunden. Im Prinzip geht der pseudobug so:

void calc(int a, int b) {
  std::cout << "func " << a + b << "\n";
}

void add(int a, int b) {
  return calc(a, b);
}

int main() {
  add(2, 3);
  return 0;
}

Na, wer sieht das Problem? Wird calc aufgerufen?

(Ja, aber explicit void zurückgeben is braindamage ;) )

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress