This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
gsl inline question
- To: Brian Gough <bjg@netsci.freeserve.co.uk>
- Subject: gsl inline question
- From: James Theiler <jt@nis.lanl.gov>
- Date: Tue, 9 Feb 1999 14:15:59 -0700 (MST)
- cc: gsl-discuss@sourceware.cygnus.com
- Reply-To: James Theiler <jt@nis.lanl.gov>
On Tue, 9 Feb 1999, Brian Gough wrote:
] 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.
Hi Brian,
I'm sorry I'm not quite following you here, and it could be because
I don't really understand inline's correctly. When I want a function to
be inline, I basically use 'inline' everywhere, in the exported .h file,
and in the implementation .c file. (One thing that bothers me about
this is that I think of inline as an implementation issue, and I don't
see why it needs to be in the prototype as well, but I think that is
a side issue from what you are saying.) You are saying there is a
separate inline and non-inline definition?? Maybe an example would
help.
Wait! Maybe you are saying that the '#define inline' will only affect
the implementation .c file; that the exported .h file doesn't include the
config.h file, and so it doesn't know whether or not to use 'inline' ??
No, now that I write that out, it doesn't sound right either.
For what it's worth, the way HAVE_INLINE's are used in gsl_math.h does
makes a lot of sense to me, but there you are going between inline's and
macro's.
jt
(sorry if this is a digression from gsl policy to generic C coding
instruction...)
---------------------------------------------
James Theiler jt@lanl.gov
MS-D436, NIS-2, LANL tel: 505/665-5682
Los Alamos, NM 87545 fax: 505/665-4414
----- Space and Remote Sensing Sciences -----