Вопрос

I program in Java, C and Python.

The rule for automatic coercions among arithmetic types have been augmented to handle the richer set of types

Source: "The C Programming Language"

But what does "coercion" mean? The answers say it's like type conversion and implicit casts and implicit type conversions and called autoboxing where I read it. So what is the difference between automboxing and coercion?

Thanks

Это было полезно?

Решение

Coercion is another name for an implicit type cast, i.e. one mandated by the language rules, and not explicitly added by the programmer.

Другие советы

Coercion refers to "type coercion". In other words, you add a variable of type Integer to a Float, the Integer will be coerced to Float, and the numbers added together.

Coercion is the process of changing one data type into another. http://en.wikipedia.org/wiki/Type_conversion

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top