This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
Re: complex number API
Exported inline functions need the inline definition (actually, extern
inline) in an exported header file and a non-inline definition somewhere
else in the library. When autoconf redefines "inline" to "" then this
can generate a duplicate definition in user code. Hence the need for
#ifdef HAVE_INLINE around the exported inline functions in header
files.
For inline functions used in a single translation unit inside the
library it should be ok to omit the HAVE_INLINE, so if there are any
examples like that they could be removed.
James Theiler wrote:
>
> I agree that the following code snippet is annoying
> #ifdef HAVE_INLINE
> inline
> #endif
> gsl_complex func()
>
> but I thought that autoconf was smarter than that, and if you asked
> it to check for whether your compiler supported inline's, and your
> compiler doesn't, then it would set
> #define inline
> in the config.h file. In that case, can't you blithely write
> inline gsl_complex func()
> and the compiler (actually cpp, I guess) will do the right thing?