I would like to know which is better. inialise a value like

int i=0;

or like this.

int i(0);

and why.

For native types I don't think it makes a difference. For user-defined types I think it may mean the difference (if any) between calling (the default constructor and [probably not in this case?]) the assignment operator and a copy constructor.

Real C++ people...?

>I would like to know which is better.
There's no difference if they both compile (they might not for user-defined types), pick which you find more intuitive.

>Real C++ people...?
I don't think I count as a real C++ person, but both call the primary (non-copy) constructor. The only noticeable difference would be if the constructor in question is defined as explicit, in which case an implicit argument would be illegal:

class test1 {
  test1 ( int init ) {}

class test2 {
  explicit test2 ( int init ) {}

int main()
  test1 a1 ( 0 );
  test1 b1 = 0;
  test2 a2 ( 0 );
  test2 b2 = 0; // This will cause an error
This question has already been answered. Start a new discussion instead.