mercredi 6 janvier 2021

Is it bad practice to do this?

In C, a kind of inline if statement without an if. It only works in some cases. For example, replacing the first with the second.

if (x > y) {
    y = x;
}
x > y && (y = x);

They're equivalent, but is the second more efficient, or is it bad practice? Should I use the first or second?

Aucun commentaire:

Enregistrer un commentaire