Implicit conversion
An implicit conversion is an automatic change of a value from one type or representation to another, performed according to language or library rules without explicit conversion syntax at the use site.
100 Java Mistakes and How to Avoid Them
Implicit conversion is an automatic type conversion performed by Java according to its conversion rules without an explicit cast or conversion call.
- How it is used
- Prevents expression, numeric, and generic-type bugs caused by Java conversions that occur without explicit casts.
- How deep it goes
- Explains conversion consequences through concatenation, conditional expressions, compound assignments, and erased generics, with avoidance guidance and inspection limits.
- Examples
- Uses `"Entry#" + index + 1`, `char c *= 1.2`, byte updates and shifts, and a `List<String>` read.
- What you can do after
- Diagnose/debug with it by spotting hidden string, numeric, and generic casts and choosing explicit safer alternatives.
Read how 100 Java Mistakes and How to Avoid Them explains implicit conversion →
100 C++ Mistakes and How to Avoid Them
An automatic conversion performed by C++ without an explicit cast or conversion request in the source code.
- How it is used
- Uses implicit conversion to explain hidden readability, correctness, and performance costs in class operations and legacy modernization.
- How deep it goes
- Explains conversion constructors, conversion operators, temporary construction, and explicit alternatives, but does not develop the full conversion-rule system.
- Examples
- Demonstrates Circle construction, Rational output and comparison, and Complex arithmetic that silently creates converted operands and temporaries.
- What you can do after
- Diagnose hidden conversions and reduce them with explicit constructors, named conversion functions, or type-specific operator overloads.
Read how 100 C++ Mistakes and How to Avoid Them explains implicit conversion →
Modern C, Third Edition
An implicit conversion is an automatic C conversion that changes a value from one type to another according to the language's conversion rules.
- How it is used
- Explains how C supplies required types for initialization, assignment, function arguments, and arithmetic expressions.
- How deep it goes
- Works through promotions and arithmetic rules, stopping short of a complete conversion table while flagging platform-dependent and precision-losing cases.
- Examples
- Uses integer and floating initializations, hexadecimal and decimal literals, mixed-sign comparisons, cosf, printf, and complex arithmetic.
- What you can do after
- Evaluate C expressions and conversions for preserved values, information loss, implementation-defined behavior, signedness hazards, and precision loss.
Read how Modern C, Third Edition explains implicit conversion →
Modern C
An implicit conversion is an automatic C conversion that changes a value from one type to another without an explicit cast.
- How it is used
- Uses automatic type changes to explain assignments, operators, comparisons, arithmetic, and restricted pointer interactions.
- How deep it goes
- Explains value fitting, literal typing, signedness, precision loss, implementation-defined results, and pointer restrictions through worked examples.
- Examples
- Uses typed initializations, hexadecimal literals, mixed-sign comparisons, pointer assignments, and byte inspection of an unsigned integer.
- What you can do after
- Evaluate conversion safety by checking value ranges, operand signedness, precision, pointer compatibility, and whether behavior is implementation-defined or undefined.
Also covered in
- Functional Programming in C#, Second Edition
- Julia as a Second Language
- PostgreSQL Mistakes and How to Avoid Them
- F# in Action: A Revised Edition of Get Programming with F#
- Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
What to know first
- float64Float64 is a 64-bit floating-point numeric type, commonly represented by the IEEE 754 binary64 format.
- integerAn integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.
- atomic typeAn atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- floating-point arithmeticFloating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors.
Related concepts
- narrowing conversionincludes · A narrowing conversion converts a value to a type with a smaller representable range or lower precision, potentially losing information.
- booleancontrasts with · A Boolean is a logical value or data type representing truth or falsity, conventionally with the two values true and false.
- data conversioncontrasts with · Data conversion is the transformation of a value or data from one type, format, or representation to another, explicitly or implicitly.
- Kotlincontrasts with · Kotlin is a statically typed general-purpose programming language that targets the JVM and other platforms and interoperates with Java.
Questions about implicit conversion
What is implicit conversion?
An implicit conversion is an automatic change of a value from one type or representation to another, performed according to language or library rules without explicit conversion syntax at the use site.
Which Manning books explain implicit conversion?
100 Java Mistakes and How to Avoid Them, 100 C++ Mistakes and How to Avoid Them, Modern C, Third Edition and Modern C.
What should I know before learning implicit conversion?
Manning books that teach implicit conversion usually introduce float64, integer, atomic type and floating-point arithmetic first.
What is the difference between implicit conversion and boolean?
An implicit conversion is an automatic change of a value from one type or representation to another, performed according to language or library rules without explicit conversion syntax at the use site. A Boolean is a logical value or data type representing truth or falsity, conventionally with the two values true and false.
What kinds of implicit conversion are there?
Kinds of implicit conversion include narrowing conversion.
What is implicit conversion also called?
Implicit conversion is also called implicit type conversion.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



