Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Dann Corbit

Date: 12:17:51 07/29/03

Go up one level in this thread


On July 29, 2003 at 14:18:55, Sune Fischer wrote:
>On July 29, 2003 at 13:39:48, Dann Corbit wrote:
>>On July 29, 2003 at 09:38:30, Sune Fischer wrote:
[snip]
>>>Absolutely, operator overloading rocks.
>>>Just try working with vectors and matrices in C :o
>>
>>That's on the one hand.
>>
>>On the other hand, there is nothing worse than operator overloading gone bad.
>>And I really mean it.
>
>It's intented to make things simpler, not more complicated.
>
>But your right of course, the powers of C++ is not for the timid.

Shot myself in the foot once.  Like every C++ newbie, I wrote a C++ number class
(this was long before the <complex> template came to be).

I thought it would be nice to use the ^ operator to represent complex
exponentiation.
BZZTT!!  Wrong operator precedence.  Thanks for playing.

Another worse gotcha is when people create a very inobvious operator overload.
Or even one that is counter intuitive.

I could write a class (for instance) where a comma represents "format the disk"
and a minus sign means concatenate two strings together.  I have seen things
nearly this strange.

Of course, you can get bizarre in C too (the "C Puzzle Book" is proof enough of
that.)  I once had the displeasure of someone giving me a function that was a
64K return statement.  He thought it was cute.



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.