[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (OT) Re: memory management
Christian Reiniger wrote:
> Sorry, couldn't resist. With your argumentation you'd have to ban free
> method naming ;) Every feature can be misused. And if used properly,
> operator overloading is very useful.
The problem is not that obvious. With normal methods, when you are
calling an Add() method that doesn't exist, well the compiler is quite
clear about it. But if you're overloading operator+ in some classes and
expect one that doesn't to behave in some manner and end up adding up
the values of two pointers, you end up with crap.
The problem is subtle errors due to the operators being overloaded,
sometimes expecting one overloaded meaning and getting another.
--
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi