Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about errors when I change my C code to C++

Author: Dann Corbit

Date: 12:04:55 02/26/03

Go up one level in this thread


On February 24, 2003 at 23:04:36, Omid David Tabibi wrote:

>On February 24, 2003 at 18:44:30, Dann Corbit wrote:
>
>>On February 24, 2003 at 18:21:53, Uri Blass wrote:
>>
>>>On February 24, 2003 at 18:00:25, Uri Blass wrote:
>>>
>>>>I see that I did not include it in the right order and now I have no problem.
>>>>
>>>>Uri
>>>
>>>Almost
>>>
>>>The only small problem is that I get slightly slower times(less than 1%
>>>difference but I do not like it)
>>>
>>>344.90 seconds against 346.86 seconds and also the time in the middle has the
>>>same pattern.
>>>
>>>I think that the exe is simply slightly slower than the previous exe because I
>>>usually get more similiar results with the same code.
>>
>>C++ offers no real performance boost.
>>
>>For either C or C++ with the MS VC++ compiler, simply select the option that
>>says "Inline any suitable function" and you will get the same sort of inline
>>benefit.
>>
>>Unless you check not to allow structured exception handling, you should see a
>>small *decrease* in performance.
>>
>>The only real reason to use C++ instead of C is for the better abstraction level
>>that is possible.
>
>Another two reasons:
>declare variables wherever you want

A blessing and a cursing.  And when it must be done, C can do it with a new
block:

C++
    /* ... */
    foo = bar();
    int temp;
    temp = calculate_stuff();

C
    /* ... */
    foo = bar();
    {
       int temp;
       temp = calculate_stuff();
    }

>use bool/true/false instead of BOOL/TRUE/FALSE

typedef enum tag_bool {false=0 /* default, but shows intent */, true } bool;

I must admit it does look better when we aren't screaming.

>:-)
>
>
>>
>>Also, you will get approximately the same warnings for either C or C++ if you
>>increase your warning level to the highest one.



This page took 0 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.