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 654793 - Add G_VALUE_INIT
Add G_VALUE_INIT
Status: RESOLVED DUPLICATE of bug 577231
Product: glib
Classification: Platform
Component: gobject
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-07-17 19:35 UTC by Marc-Andre Lureau
Modified: 2011-07-17 20:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add G_VALUE_INIT (2.44 KB, patch)
2011-07-17 19:35 UTC, Marc-Andre Lureau
none Details | Review

Description Marc-Andre Lureau 2011-07-17 19:35:56 UTC
The implementation of GValue is not public or documented.  When
allocated on the stack, initializing a GValue is usually done as
documented with:

GValue value = { 0, };

There is lot code around (including WebKit) that added all the missing
fields, resulting in this ugly and non-obvious:

GValue value = { 0, { { 0 } } };

However, this doesn't play nice with -Wmissing-field-initializers for
example. Instead, we could provide a macro doing the right job.

I propose instead this:

GValue value = G_VALUE_INIT;

Similar to other _INIT macros in GLib.
Comment 1 Marc-Andre Lureau 2011-07-17 19:35:59 UTC
Created attachment 192142 [details] [review]
Add G_VALUE_INIT
Comment 2 Marc-Andre Lureau 2011-07-17 19:38:31 UTC
Hmm, wrong order of paragraphs. It must be read as GValue value = { 0, }; doesn't play nice with -Wmissing-field-initializers.
Comment 3 Marc-Andre Lureau 2011-07-17 20:22:45 UTC

*** This bug has been marked as a duplicate of bug 577231 ***