[Development] Some Qt3D feedback
Matthew Woehlke
mw_triad at users.sourceforge.net
Tue Jun 16 16:27:15 CEST 2015
On 2015-06-16 09:33, André Somers wrote:
> Marc Mutz schreef op 16-6-2015 om 15:41:
>> For type conversions, you're supposed to use static_cast on the rhs:
>>
>> auto integer = static_cast<int>(someLongLong);
>
> Sorry, but that just looks silly to me. Why obfusticate the type of the
> variable - making it harder to reason about the code - when it yields
> you nothing at all?
Ignoring whether or not to use 'auto', there actually *is* a reason to
use the static_cast... it communicates that, yes, you really want back
an 'int', even if that means a conversion loss e.g. because your input
is a 'double'. (See e.g. '-Wconversion'.)
--
Matthew
More information about the Development
mailing list