Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C or C++ for Chess Programming?

Author: Dann Corbit

Date: 23:20:37 08/17/00

Go up one level in this thread


On August 18, 2000 at 02:03:01, Sven Reichard wrote:
[snip]
>>>/* 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;
>>>}
>This program's output is compiler and hardware dependent, but that has nothing
>to do with C/C++, does it?

A C compiler must emit sizeof(int) for sizeof('a')

A C++ compiler must emit sizeof(char) for sizeof('a')


It is fairly unusual for char and int to be the same size (though it is not
illegal).

[snip]



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.