exporting GArray elt_size



hi all,

i think it'd be a good idea to expose GRealArray.elt_size from
garray.c as GArray.elt_size, in order to allow for g_return_if_fail()
statements in places where GArrays are passed around in APIs.
e.g.

void foo (GArray *float_array);

which takes GArrays created with g_array_new (0, 0, sizeof (float));
can then do:

{
  g_return_if_fail (float_array != NULL);
  g_return_if_fail (float_array->elt_size == sizeof (float));
  
  /* .. */
}

yes, this is still not typesafe, but readouts etc. at least operate on
asserted element sizes that way.

objections?

---
ciaoTJ





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