Re: MATH_MOD: Include in GLib?
- From: Jan Kratochvil <rcpt-gtk-devel-list AT gnome org jankratochvil net>
- To: Sven Neumann <sven gimp org>
- Cc: drlion-dated-1091219837 02c327 teepee ath cx, gtk-devel-list gnome org
- Subject: Re: MATH_MOD: Include in GLib?
- Date: Mon, 26 Jul 2004 11:49:01 +0200
On Mon, 26 Jul 2004 10:43:21 +0200, Sven Neumann wrote:
> Daniel Brockman <drlion deepwood net> writes:
...
> > #define MOD(x, m) ((x) >= 0 ? (x) % (m) : (m) + (x) % (m))
...
> If at all it would have to be G_MOD(x). But I doubt that
> the semantics of such a macro are obvious enough and that it would be
> of general usefulness.
I consider this macro as a generally used workaround of a bug in C standard.
I intuitively expect the result of "x%m" will be 0..(m-1), not the C result
of -(m-1)..(m-1). It has similiar position as G_N_ELEMENTS().
> Shouldn't defining it in one of your headers be good enough?
It applies to the whole utility part of GLib.
Regards,
Lace
--
Jan Kratochvil; Captive: free r/w NTFS Filesystem; http://www.jankratochvil.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]