Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C++ Programming Q: are const and define efficiency the same

Author: Robert Hyatt

Date: 19:35:55 01/16/04

Go up one level in this thread


On January 16, 2004 at 22:15:34, Federico Corigliano wrote:

>Hi
>
>In my engine I have a lot of #defines as:
>#define FileA 0xFFFFFFFF  <- I don't remember the real value
>and I want to convert it to:
>const UINT64 FileA = 0xFFFFFFFFF;
>I the change can affect the speed. As I often use MSVC Debugger, it's boring to
>translate every #define to the respective number.
>
>Federico

I don't think there will be much difference.  Using a #define might produce
some asm code with 32 bit immediate values which will bloat the code a bit,
while using the const int64 will plop one copy of the value in memory making
it fit in cache maybe a bit better.

Best bet is to try it and see which is faster for _your_ program and machine.





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.