Since the 2011 revision of C++ standards, variables can be initialized in three different ways given below.
int i = 0;
int i (0);
int i {0};
As far as I know all three different initializations have the same effect. If they all have the same effect, why not stick to one way of initialisation like the first one? Is there any special need to initialise variables by surrounding their initial values in () or {}?
Aucun commentaire:
Enregistrer un commentaire