please excuse very basic questions: gchar and g_free()



Hi,

I've got some basic questions about gchar:

What's actually the size of the array: gchar g[10]? 10 bytes (0-9) or 11
(0-11)?

Is the last byte occupied by a 0 to terminate the array?

How would g_free() behave if I had created the array with the new
operator and would then overwrite the last byte (zero) with another
value?

Is it okay to do reinterpreting casts from gchar* to guint8* (and vice
versa) or do I loose the terminating 0 byte? Further, could a single
gchar be 2 bytes long in some contexts (maybe because of a two-byte
character table)?

Finally, how does g_free know from a dynamically created guint8 array
where is its end in memory?


I hope I didn't bother anyone with these things...

 Felix



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