[OpenAFS] Syntax error in afs_md5.h on FreeBSD
Wed, 29 Aug 2007 10:28:25 -0700
Jim Rees <firstname.lastname@example.org> writes:
> I would change the "static inline" to "inline." "static inline" doesn't
> make any sense to me in an include file, but I'm not familiar with that
A function defined with "static inline". Stand-alone object code may
be emitted if required. You can have multiple definitions in your
program, in different translation units, and it will still work. Just
dropping the "inline" reduces the program to a portable one (again,
all other things being equal).
This is probably useful primarily for small functions that you might
otherwise use macros for. If the function isn't always inlined then
you get duplicate copies of the object code, with the problems
A sensible approach would be to put the "static inline" functions in
either a header file if they are to be widely used or just in the
source files that use them if they are only ever used from one file.
"static inline" used to be a GNU extension, I believe, but it appears that
C99 now defines it with the same semantics as GCC. I'm not sure why
you're getting a syntax error, but given the semantics of static inline, I
think the safe fix is to remove the "inline", not the "static". That will
give you the same semantics without the inlining, and should therefore
work the same, just a bit slower.
Of course, in this particular code, it may not matter -- I haven't looked
Russ Allbery (email@example.com) <http://www.eyrie.org/~eagle/>