Yes, please do it. I created the INLINE macro, and I can see the awful
confusion being created here, so please do what needs to be done to
clarify things.
Then, *document* how it works in the source file, where the macros are
defined!
Hrvoje Niksic wrote:
"Kirill 'Big K' Katsnelson" <kkm(a)dtmx.com>
writes:
> Some time ago, Andy Piper wrote...
> > * redisplay-msw.c (get_frame_compdc): gcc can't cope with this
> > inline.
> > (get_frame_dc): ditto.
>
> Could you please then conditionalize this on kind of
> BROKEN_GCC_INLINE? Finally, if INLINE does not work with gcc why is
> not it defined to static?
Beware, INLINE in XEmacs is not what you might think it is. Maybe
this is how Andy got burned.
#ifndef NOT_C_CODE
#ifdef __cplusplus
#define HAVE_INLINE 1
#define INLINE inline
#else /* not C++ */
/* Does the keyword `inline' exist? */
#undef HAVE_INLINE
#undef inline
# ifdef HAVE_INLINE
# ifdef __GNUC__
# ifdef DONT_EXTERN_INLINE_FUNCTIONS
# define INLINE inline
# else
# define INLINE extern inline
# endif
# else
# define INLINE static inline
# endif /* __GNUC__ */
# else
# define INLINE static
# endif /* HAVE_INLINE */
#endif /* not C++ */
#endif /* C code */
Notice how in almost all files INLINE is #defined to _extern_ inline,
not to static or static inline as one would assume. This is so that
the inline functions defined in headers work right.
I think we should change it so that:
* we rename existing INLINE to HEADER_INLINE, so that at least the
name suggests what's going on.
* we introduce a "real" INLINE macro that does the right thing in C
sources. INLINE would expand to `inline' in Gcc (and other
compilers that support inline the same way), `static inline' in C++,
and to nothing otherwise.
--
Ben
In order to save my hands, I am cutting back on my mail. I also write
as succinctly as possible -- please don't be offended. If you send me
mail, you _will_ get a response, but please be patient, especially for
XEmacs-related mail. If you need an immediate response and it is not
apparent in your message, please say so. Thanks for your understanding.
See also
http://www.666.com/ben/typing.html.