vendredi 2 novembre 2018

Calling method multiple times in c++

I want to know whether the gcc compiler optimizes the following method calls.

bool methodY()
{
  ..some operations..
  return true;
}


int methodX() {
  if(methodY() == true)
    return methodY();

  ..some operations..
}

Inside the methodX, will the compiler optimize calling of methodY two times or it will just let it be?

Aucun commentaire:

Enregistrer un commentaire