Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What a difference...

Author: Russell Reagan

Date: 18:07:57 01/22/02

Go up one level in this thread


I'm just analyzing a few loops and originally I was using C++ and iostream's
cout for displaying the result. I wondered if compiling the same thing in C and
using printf would make any difference...it did. Before I could hardly read the
ASM because it was strung out with all kinds of garbage. The ASM/source file
generated using C was 2K, the C++ one was 440K. Go figure, all for this:

#include <stdio.h>

void main() {

	char squares[64];
	int i;
	int found = 0;

	for(i = 0; i < 64; i++) {

		if(squares[i] == 1)
			found = 1;

	}

	printf("%d",found);

}

You think there might be a little hidden overhead in C++?!

Russell



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.