CS 3304: Comparative Languages
Arithmetic Expressions
[
Course Documents
] : [
Arithmetic Expressions
]
Previous
Contents
Next
Keyword Index
Operator Overloading
Some is common (e.g., + for int and float)
Some is potential trouble (e.g., * in C and C++)
Loss of compiler error detection (omission of an operand should be a detectable error)
Can be avoided by introduction of new symbols (e.g., Pascal's div)
C++ and Ada allow user-defined overloaded operators
Potential problems:
Users can define nonsense operations
Readability may suffer