Skip to content

Files

Latest commit

 

History

History
11 lines (6 loc) · 452 Bytes

truncLongCastReturn.md

File metadata and controls

11 lines (6 loc) · 452 Bytes

Pattern: int result is returned as long value

Issue: -

Description

int result is returned as long value. If the return value is long to avoid loss of information, then there is loss of information. To avoid loss of information you must cast a calculation operand to long, for example return a*b; => return (long)a*b.

Further Reading