vendredi 19 août 2016

C++: should you use {} brackets with if statements [duplicate]

This question already has an answer here:

My question is which of the following is best to use in C++:

if (...) {
    // then...
}

or:

if (...)
    // then

Both work, as far as I can tell, and I've seen references to both. So which is considered better style? Is it a per-programmer basis, or does it affect compilation, or anything else?

Thanks!

Aucun commentaire:

Enregistrer un commentaire