Results (
English) 1:
[Copy]Copied!
As you can see, to check whether narrowing applies, even the current values might be considered, if
available at compile time. As Bjarne Stroustrup writes in [Stroustrup: FAQ] regarding this example:
"The way C 11 avoids a lot of incompatibilities is by relying on the actual values of initializers
(such as 7 in the example above) when it can (and not just type) when deciding what is a narrowing
conversion. If a value can be represented exactly as the target type, the conversion is not narrowing.
Note that floating-point to integer conversions are always considered narrowing— even 7.0 to 7. "
Being translated, please wait..
