Overloading methods in C API
Erik Max Francis
max at alcyone.com
Sat Jan 18 20:41:42 EST 2003
Grzegorz Adam Hankiewicz wrote:
> > Nonsense. The operators + - * / do different things depending on
> > the types of their operands. That's operator overloading.
>
> Maybe you are refering to C's usually warningless type coercion in
> mathematical operations? Or you know of a way to add two strings
> and have them concatenated? Please ellaborate.
Well, for one thing, + can do both numeric and pointer arithmetic. Very
different things. - also means unary negation (+ also has a unary form
but it is a no-op), and as well as being useful for both pointer
arithmetic _and_ computing the difference between two pointers (a
variant of pointer arithmetic where both operands are compatible
pointers). * is also used for dereferencing pointers. And do so on.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Mona Lisa / Come to discover / I am your daughter
\__/ Lamya
7 Sisters Productions / http://www.7sisters.com/
Web design for the future.
More information about the Python-list
mailing list