3 ms·
My copy of K&R disagrees with you that implicit conversion didn’t exist in C. See section 2.7 “Type conversions”. “Implicit arithmetic conversions work muc
by seanhunter 1y ago
My copy of K&R disagrees with you that implicit conversion didn’t exist in C. See section 2.7 “Type conversions”.
“Implicit arithmetic conversions work much as expected. In general, if an operator like + or * that takes two operands (a binary operator) has operands of different types, the ``lower'' typekis promoted to the ``higher'' type before the operation proceeds.”
It goes on including giving a table of all the conversions and a set of heuristics which normally apply.
- monkeyelite 1y agoWhere do you see the disagreement? Numbers are implicitly converted to the “largest” and perhaps “floatiest” representation.