Overloading methods in C API
Grant Edwards
grante at visi.com
Sat Jan 18 22:06:09 EST 2003
In article <mailman.1042934674.24272.python-list at python.org>, Grzegorz Adam Hankiewicz wrote:
>> >> For whatever historical reasons, operator overloading and
>> >> function/method overloading are usually considered as two
>> >> separate language features. C and python have the former but
>> >> not the latter.
>> >
>> > *cough* C has neither.
>>
>> 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.
Those operators don't happen to work on strings. That's neither here nor
there.
The "+" operator can mean several things:
integer addition
pointer addition
floating point addition
unary postive
The "-" can mean several different "subtraction" operations (integer, fp,
pointer) and can also be unary negation.
The "*" operator does two different multiplaction operations (integer, fp)
as well as de-referenecing pointers.
Back when I studied language design, that was called "operator overloading".
Perhaps the definition has changed since then -- it was 15 years ago.
--
Grant Edwards grante Yow! HAIR TONICS, please!!
at
visi.com
More information about the Python-list
mailing list