[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HAVE_INLINE (Re: [gnugo-devel] engine/influence.c (and DFA))

From: Arend Bayer
Subject: HAVE_INLINE (Re: [gnugo-devel] engine/influence.c (and DFA))
Date: Tue, 3 Sep 2002 19:04:00 +0200 (CEST)

On Tue, 3 Sep 2002, Marco Scheurer wrote:

> Speaking of micro optimizations and speed/space trade offs, I've been
> wondering...

I've been wondering about using inline. I guess all compilers that we
care much about support inline as an extension. Hence we could write
a configure test to define HAVE_INLINE or (similar to
HAVE_VARIADIC_...), and then do

#define GG_INLINE inline
#define GG_INLINE

static GG_INLINE get_foo_size()
  return foo.size;

Actually, I am suggesting this not so much as a speed-up (though I do
think a couple of functions in board.c would benefit from it), but it
can also be a code clean-up if we
* replace macros by functions (better readable, and we get type checking)
* are more willing to split up big functions into smaller functions
(at least for me, big functions are the most likely place to introduce
bugs -- stuff like wrongly initializing variables etc. simply don't
happen as easily if the whole function fits on a screen)
* we could also unify the various TRACE() definitions as a single
inline function

(The GCC manual suggests using __inline__ for ANSI-conformant use of
inline. I have no idea how portable that would be.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]