After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 145767 - g_array_free should return a gpointer instead of a char*
g_array_free should return a gpointer instead of a char*
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2004-07-08 19:07 UTC by Benoît Dejean
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
2 lines patch (1.17 KB, patch)
2004-07-08 19:08 UTC, Benoît Dejean
none Details | Review

Description Benoît Dejean 2004-07-08 19:07:27 UTC
g_array_free returns a char* which is meaningless to me. It just implies that i
need to cast it whenever i want to use it. a gpointer would be better.

i don't think this will break anything except C++ code assuming that g_ptr_array
returns a char*

char *data = g_array_free(array, FALSE);

switching to gpointer will require explicit casting. btw, in C void*<->T* is
implicit, no problem.

good bye casts :D
Comment 1 Benoît Dejean 2004-07-08 19:08:12 UTC
Created attachment 29358 [details] [review]
2 lines patch
Comment 2 Benoît Dejean 2004-09-09 15:59:07 UTC
why won't fix ?
Comment 3 Matthias Clasen 2004-09-09 17:14:39 UTC
"...is meaningless to me", "...would be better" and "don't think this will break
anything except C++" are not very convincing arguments to change working code.
Comment 4 Benoît Dejean 2004-09-09 18:19:52 UTC
ok. look at the GArray interface : it's all about gpointer/gconstpointer ...
except g_array_free ...
Comment 5 Benoît Dejean 2004-09-17 21:47:28 UTC
may be you can explain me why g_array_free returns a gchar* ?
Comment 6 Benoît Dejean 2004-09-26 18:41:42 UTC
gcc warns: "cast increases required alignment of target type" on some archs
(e.g. sparc64)

(T*) g_array_free(a, FALSE);