Please read the question entirely before you think to mark it as duplicate. The statement like
int i=int();
most programmers will say that there is value initialization here & i
will be value initialized. (0 as output). But it also prints 0 as output on C++98 compiler.
Following program that I tested on C++98 implementation and gives me 0 as output.
#include <iostream>
int main()
{
int i=int();
std::cout<<i;
}
Don't say that i is value initialized in above C++98 program ,because value initialization introduced in C++03. So How i is initialized here? Is it really constructor call? int() looks like constructor call. Primitive types have also default constructors in C++ as said by Bjarne stroustrup in his book C++ programming language & TC++PL.
The C++ programming language Bjarne stroustrup:
10.4.2 Built in types also have default constructors
also read section 6.2.8 of same book.
The following links also says that built in types have default constructors in C++.
1) http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=15
2) http://www.geeksforgeeks.org/c-default-constructor-built-in-types/
So can I really say that it is a constructor call of the integer type?