Eike Lange wrote:
On Mon, Feb 26, 2001 at 07:04:38AM +0100, Frank Heckenbach wrote:
A routine to check a given date (with or without checking DayOfWeek) would be nice, and I might write it someday (too busy right now), but if you have such a routine to contribute, let me know...
We have such in our GLib-Unit, GDateValid(...). Just wait a few days :-)
I looked at it. But it operates on a different type (PGDate). Converting to and from it, and linking glib is probably much more effort than writing the function in Pascal which shouldn't take more than a few lines. (I don't mean to put down the project, but using a set of date/time routines that operate on yet another type (as if there weren't more than enough already) is probably not such a good idea unless one is porting a C program that uses glib already...)
BTW, when I looked at the unit, I saw `function GPOINTER_TO_INT(x : Pointer) : Integer;' at the end. That's very dangerous. If you have to cast between pointers and integers at all for some reason, use PtrInt or PtrCard which is guaranteed to have the same size. On some 64 bit platforms, Integer is still 32 bit and Pointer is 64 bit, so this routine is a sure way to produce invalid addresses. (I don't know if glib uses `int' where it accepts pointers, but if it does, it's not 64 bit safe, either...)
Frank