And now a question to show that I never had a formal c/c++ education.
Are the below functions equivalent ?
void funcA ()
{
gchar *varA = g_strdup ("Test");
<do something with a>
g_free (varA);
}
and
void funcA ()
{
const gchar *varA = g_strdup ("Test");
<do something with a>
}
I'm mostly wondering if the second function would have a memory leak or
not. If varA is defined as a const gchar *, will the program
automatically free the memory allocated with g_strdup ?
I don't expect so, but I'm seeing mixed uses in GnuCash and want to
determine for once and for all what is the proper way to handle this.
Geert
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel