I'm not used to C99. I've defined some inline functions in a header file like this:
/* Manhattan distance between (xa, ya) and (xb, yb) */
inline int mdistance(pt *a, pt *b) {
return abs(a->x - b->x) + abs(a->y - b->y);
}
And declared them in the .c for that header file:
extern inline int mdistance(pt *a, pt *b);
However, I need to use those functions in other .c files. I simply included the header file, but it seems I have to declare the "extern inline" in every .c for every inlined function I use. Is that correct? If so, doesn't that miss the point of header files? I ended up with a bunch of .c files including the same header file and also declaring a bunch of redundant "extern inline"s in the beginning. I mean, the definition is in the header file, why would I need to declare it everywhere? PS: Not only that, if I declare one "extern inline" and it uses another inlined function I have to declare "extern inline" for that function too!