GLib gdate.c assertion error

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

 



Relevant info:

    glib: glib-2.2.2
    OS: Solaris 8
    cc: gcc 3.1.1

The following code works as expected:

    #include <stdio.h>
    #include <glib.h>

    int main (int argc, char*argv[]) {

        GDate *gdate;
        gdate = g_date_new_dmy (6, 7, 2003);

        if (g_date_valid(gdate))
            printf ("date is good\n");
        else
            printf ("date is bad\n");

        return(0);
    }


It outputs "date is good".

However, when I change the input to g_date_new_dmy() to an invalid date,
like this:

        gdate = g_date_new_dmy (56, 7, 2003);

I get the following:


    $ ./datetest
    (process:2444): GLib-CRITICAL **: file gdate.c: line 57 (g_date_new_dmy): assertion `g_date_valid_dmy (day, m, y)' failed

    (process:2444): GLib-CRITICAL **: file gdate.c: line 102 (g_date_valid): assertion `d != NULL' failed
    date is bad

Are the above GLib-CRITICAL statements supposed to be there?

The main reason I am calling g_date_valid() is to check the validity of
the inputted date, it doesn't seem to make sense that g_date_new_dmy()
should barf when I feed it a bad date.

Thomas

-- 
N. Thomas
nthomas@cise.ufl.edu
http://www.cise.ufl.edu/~nthomas/
Etiamsi occiderit me, in ipso sperabo


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux