Re: MATH_MOD: Include in GLib?
- From: Daniel Brockman <drlion deepwood net>
- To: gtk-devel-list gnome org
- Subject: Re: MATH_MOD: Include in GLib?
- Date: Wed, 28 Jul 2004 07:52:48 +0200
Owen Taylor <otaylor redhat com> writes:
> While I agree that this interpretation of modulo is frequently useful,
> I'm not really sure it belongs in GLib. Code is probably going to
> be clearer if the definition is next to the use.
On the other hand, if the macro is used in several different places,
the code is going to be much clearer if it uses standard GLib stuff
that one can quickly look up in the GLib reference manual.
Another concern is that the lack of a standard facility will
undoubtedly make some fainthearted programmers worried that what they
are trying to do is somehow wrong or taboo. When they are ultimately
forced to create their own macro, the shame that this will cause might
discourage them from sharing their software. Clearly, this will only
lead to software hoarding, which I think we can all agree is bad.
(After all, Hitler was probably a software hoarder.)
> Certainly calling it something like G_MOD() is not appropriate as
> much as I'd agree that the C standard is screwed up in this
> choice. I'm not sure what you would call it. You also usually want
> the equivalent division at the same time.
To illustrate the fact that our macro always reduces its input to a
single canonical congruence class, G_FULL_MOD might be appropriate.
I don't know about G_FULL_DIV, though...
The name I used was actually MATH_MOD, because I felt that my
semantics were more mathematically correct, but I'm not sure how
appropriate this is.
Actually, G_MATH_MOD and G_MATH_DIV may not be too bad, because you
will be forced to look them up. With G_FULL_MOD, I think the risk is
higher of people assuming weird things based on their own
interpretations of the word ``full''.
--
Daniel Brockman
drlion deepwood net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]