Any difference between (T) value and T (value)?

Any difference between (T)value

and T(value)

? For example (float)3.14

and float(3.14)

. Which is faster or better?

+3


source to share


1 answer


They have exactly the same effect and meaning:

ISO / IEC 14882: 2011 5.2.3 Explicit type conversion (functional notation):



A simple type specifier (7.1.6.2) or typename-specifier (14.6), followed by a parenthesized list of expressions, constructs a value of the specified type given the list of expressions. If the expression list is a single expression, the type conversion expression is equivalent (in the definition and, if defined by meaning) to the corresponding expression of expression (5.4).

5.4 - "Explicit type conversion (excellent notation)", ie (listing).

+7


source







All Articles