Re: glib pseudo random number generator has landed.


> > 1. Is it possible to make glib dependent on '-lm' (the math lib), I 
> >    would
> >    like to add code to generate a normal distributed (as opposed to a
> >    equal distributed random number). I need the math lib for that. The
> >    code is uncommented for the time being. I'm willing to remove it,
> >    if -lm is unwelcome (what I can perfectly comprehend).
> This should be ok...  If systems are missing libm, you can easily
> provide replacements using autoconf facilities.

Yeah, but that would mean, that all programs using glib have to be linked
against -ln and that might be undesirable (the two biggest projects using
glib (GTK+, ORBit) already link -lm however). So doublecheck your opinion.

> * update the copyright for 1999.  I dunno what the 'official' position
> on copyrights are, but I personally assign my public code to the Free
> Software Foundation, as in gqueue.c.
> I think there are some other Glib files which have been touched in
> 1999, but have not had their copyrights updated.

I"m really no expert in that area, so I leave the update of the years to
others. As to the assigment of code. It actually is not coded by me, so I
can't assign it to someone. I only adapted the code to glib.

> * using stdio in g_rand_new() seems like a lot of overhead.  wouldn't
> open/read/close be better, since we have no need for stdio's buffering
> in this case.

That way it's more portable. 

> * it might be nicer to test for /dev/random in, and then
> call [f]open on G_DEV_RANDOM.  That allows for any variance in the
> naming of /dev/random facilities, and also allows you to omit the
> /dev/random code completely on systems that do not support it.

glib might be compiled on a computer, that doesn't have /dev/rondom and
run on another computer with it later. So I would leave it that way. But
I'll introduce a status variable, that ensures, a unaccessable file is
only opened once.

> * style issues...
>         g_return_if_fail (rand != NULL);
> is much more commonly found in Glib and GTK+ code than
>         g_return_if_fail (rand);


> * in glib.h, the typedef struct is typically found with other typedefs,
> not with the function prototypes.

ok, thats a leftover from the first try. I'll correct this.

> * in function declarations, the lack of parameters is prototyped using
> void throughout glib.h, instead of the empty set:
>         gdouble g_random_double        ();

ah, yes, ok. I already did it in some places, but not yet everywhere. Now
it is fixed..
> * can you expand rand-test.c a bit?  :)  A good goal is to call each
> public function [if possible], that at least assures all functions
> actually work.

I'll have a look.

Sebastian Wilhelmi                   |            här ovanför alla molnen           |      är himmlen så förunerligt blå   |

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]