Starting to help develop code introduction
jralls at ceridwen.us
Thu Nov 7 14:51:31 EST 2013
On Nov 7, 2013, at 9:55 AM, Alex Kempster <alkempster.cu at gmail.com> wrote:
> Thank you John Ralls,
> That was very informative. I now have the git version downloaded and
> compiling successfully (Horah!).
> I have been getting used to the existing source code over the past hour or
> so and realised there are a few cases were magic numbers are used:
> gint hours = -bias / 60; // 60 minutes per hour
> gint minutes = (bias < 0 ? -bias : bias) % 60;
> Would it be beneficial to replace the numbers with more meaningful
> definitions such as:
> #define MINUTES_PER_HOUR 60
> gint hours = -bias / MINUTES_PER_HOUR;
> gint minutes = (bias < 0 ? -bias : bias) % MINUTES_PER_HOUR;
> The definition would, in this case be stored in gnc-date.h
> I think it could improve readability as well as help me to get more
> familiar with the code base!
> Any thoughts welcome
It *would* improve readability, and it’s something I’m generally in favor of, but that’s also a class that’s near the front of the line for replacement as we try to wean ourselves from Glib, at least in engine and friends, so it’s probably not worth putting any effort into it now.
It’s also so trivial a change that I don’t see much advantage to it in terms of code familiarity. Better that you browse through the bug list and find something there that looks interesting to you.
More information about the gnucash-devel