mardi 4 août 2015

Nested If condition and logical AND operation

void somefunction(struct *str, const char *status)
{
 if (str != NULL)
   {
      if (status != NULL)
      {
         str_copy(str->something, status, sizeof(str->something));
      }
   }
}

//which is better in the sense of CPU cycle above one or bellow one ? Which takes more CPU cycle ?

void somefunction(struct *str, const char *status)
{
 if (str != NULL && status != NULL)
   {
         str_copy(str->something, status, sizeof(str->something));

   }
}

Which takes more CPU cycle ?

Aucun commentaire:

Enregistrer un commentaire