Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C++ question (OT)

Author: Larry Griffiths

Date: 18:52:51 01/18/01

Go up one level in this thread


On January 18, 2001 at 18:22:21, David Rasmussen wrote:

>Is there any reason _not_ to use inline functions instead of small utility
>macros?
>
>For instance, would there be any difference between
>
>#define File(sq) (sq & 7)
>
>and
>
>inline int File(int sq)
>{
>  return (sq & 7);
>}
>
>besides the type checking and other nice things that might be gained?
>
>Would there be any downside to the inline function?

I have the Borland Builder 5 compiler and it may or may not honor the inline.  I
have gone to #defines to get around this.  I would like to use templates, but
the compiler does not allow inline assembly in templates.  I also have problems
sometimes with inline assembler code in an inlined function so I have stayed
away from it.

It may be just fine and dandy with your compiler.  Try it and use your debugger
to see if the #define code is the same as the inline code.

Larry.



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.