On Thu, 19 Apr 2007, Bernd Schubert wrote: > while looking into the source due to our recent problems, I see there > are several macros, which could be replaced by static (inline) > functions, e.g. in GSource.c. > > Is there a reason to use macros? Do you mind if I convert this into > functions?
My reply here isn't either yes or no. It is simply recollection and observation from about a year ago. See: http://cvs.linux-ha.org/viewcvs/viewcvs.cgi/linux-ha/lib/clplumbing/GSource.c?r1=1.79&r2=1.80 There are some "longclock_t" things in there which benefitted from being wrapped up as (abstracted into) functions, because of alignment requirements on some architectures (e.g. sparc) which were being adversely affected by some suboptimal casting that happened before that (beneficial) function abstration. In short, there are places in GSource.c that are sensitive to architectural issues for this portable "heartbeat" package. Perhaps you could describe a little more your intentions (what functions, a sample rewrite (even if only pseudo-code) etc.). Incidentally, when you say "static (inline) functions", what do you mean by "inline"? The "static" qualifier, in this context, simply means that the function's scope is restricted to that compilation unit and it is not linkable from other compilation units. I'm not sure what you mean by "inline". Some optimisation levels of some compilers might choose, under certain conditions, to put the code of a short function "in line" from the places where it is called, rather than separately, thus removing the (small) runtime function setup/teardown overhead. But that's an internal detail and judgement-call made within an optimiser, not a user-visible thing (unless one gets deep in there with "gdb" etc.). Hope that helps. -- : David Lee I.T. Service : : Senior Systems Programmer Computer Centre : : UNIX Team Leader Durham University : : South Road : : http://www.dur.ac.uk/t.d.lee/ Durham DH1 3LE : : Phone: +44 191 334 2752 U.K. : _______________________________________________________ Linux-HA-Dev: [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
