Im looking for some technical clarification regarding exactly what the
differences, if any, are between the two pieces of code are, aside
from the obvious syntactical differences.
int x = 5;
int x(5);
First off, are they expected to be compiled into identical or
different machine code?
The later seems to take the form "object x of type int is being
constructed with a parameter of 5"
The first snippet can also considered a form of default construction
with regards to instantiating objects of class types for
single-parameter constructors.
However since the first snippet is also valid C style syntax and the
second snippetis not, it seems less clear in the first snippet whether
or not an object is actually being constructed.
Refering to 3.9.1 section 3 of the standard, the phrase "pointer to an
object of type int" seems to validate the notion of and int being an
object.
So, to what end exactly are native types such as int and double
objects?
What differences, for example, are there between C and C++ with
regards to "int" and its seemingly apparent construction in C++?
Similarly, consider the following:
int x = int( y * z );
Perhaps asking this question is premature without knowing the answers
to what I have already asked, but aside from a possible conversion
depending on what types y and z are, is there not also construction of
an object of type int taking place on the RHS?
Regards,
Charles