Author: Dann Corbit
Date: 16:41:46 08/16/00
Go up one level in this thread
On August 16, 2000 at 18:56:15, Tom Kerrigan wrote:
>C++ is a superset of C.
This is largely true, but there are enough exceptions to make a remark.
There are a very large number of legal C programs which cannot be compiled as
C++. There are C and C++ programs which will operate differently, depending
upon whether you are compiling as C or C++. Trivial examples:
/* Perfectly legal C, but not legal C++ */
/* Hint: just changing the variable names to non C++ keywords is not enough to
fix this program to make it legal C++ */
#include <stdlib.h>
int main(void)
{
int *new = malloc(5);
int delete = 0;
return delete;
}
/* Legal in C and C++, but answers are different: */
#include <stdio.h>
int main(void)
{
printf("sizeof the letter 'a' is %d\n", sizeof('a'));
return 0;
}
>You will be able to write your chess program in C, compile it with a C++
>compiler, and get exactly the same performance.
>
>If you use C++ features, your performance will decrease depending on which
>features you use and how often you use them. The performance hit can range from
>trivial to extreme.
>
>In my opinion, the goal of OOP is to organize and simplify complicated things. I
>don't think a chess program is so complicated that it can benefit from OOP.
I do agree with your general premise.
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.