vendredi 9 juillet 2021

Don't need a return after throw - standard or compiler specific? [duplicate]

If I have function like this

int f()
{
   //something
   if ()
   {
      //something
      return 1;
   }

   throw std::runtime_error("msg");
}

In Visual studio in compiles ok and works as expected, but is it a standard thing that after throw I don't need a return statement, or it can lead to some error on other compilers?

Aucun commentaire:

Enregistrer un commentaire