bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Option to not use inline


From: Bruno Haible
Subject: Re: Option to not use inline
Date: Tue, 15 May 2007 01:47:43 +0200
User-agent: KMail/1.5.4

Shawn W. wrote:
> I'm calling a gperf-generated lookup function from multiple different  
> source files.  Inlining doesn't work with that setup.

How come? gperf emits inlining directives for the lookup function only when
the --language is not set to C++, and it protects the directives so that they
are effective only with GNU C. The GNU C manual, section "An Inline Function
is As Fast As a Macro", says about the GNU C "inline" semantics:

    Note that in C and Objective-C, unlike C++, the `inline' keyword
    does not affect the linkage of the function.

Therefore you shouldn't have a problem.

Please send an example, including the input to gperf, the gperf command line
options, the further linking command lines, and the final error messages.
And of course the version numbers of all invoked tools.

> Another issue:
> 
> The lookup function never  checks to make sure it's not getting  
> passed a null pointer.

You can check against a NULL pointer in the caller of the lookup function.
By doing so, you will get more efficient code than if the test was in the
gperf generated function (because in the case of NULL you save a function
call).

Bruno





reply via email to

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