Computer Chess Club Archives


Search

Terms

Messages

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

Author: Russell Reagan

Date: 23:42:04 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

This will probably depend on which C++ compiler you are using. I would feel
confident that the newest Microsoft and Intel compilers would both handle this
kind of thing correctly. Probably the GNU C++ compiler will too. Older compilers
might not do such a good job, but even then I would expect it to only cause a
small slowdown.

Unless you are using a C++ compiler from the 1980s, the typesafety alone is
probably worth any tiny slowdown you might experience :)



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.