Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:35:17+00:00 2026-06-14T09:35:17+00:00

The code GValue value = { 0 }; gives the following warning: missing initializer

  • 0

The code

  GValue value = { 0 };

gives the following warning:

missing initializer [-Wmissing-field-initializers]

I know that’s a GCC bug, but is there some trick to remove it? It is really not nice see such unreal warnings. But I don’t want power off the warning because it will hide real warnings from me too. And sorry, but I can’t update my GCC to 4.7 (where looks like it was fixed) version, yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:35:18+00:00Added an answer on June 14, 2026 at 9:35 am

    Use G_VALUE_INIT to initialize GValue-s. Their (private) structure is in /usr/include/glib-2.0/gobject/gvalue.h which #define G_VALUE_INIT appropriately.

    I strongly disagree with your assessment that it is GCC’s bug. You ask to be warned if a field is not explicitly initialized with -Wmissing-field-initializers and you get the warning you deserve.

    Sadly G_VALUE_INIT is not documented, but it is here. Code with

    GValue value = G_VALUE_INIT;
    

    There is no universal solution to never get the warning about missing field initialization if -Wmissing-field-initializers is asked. When you ask for such a warning, you require the compiler to warn of every incomplete initializers. Indeed, the standard requires than all the non-explicitly initialized struct fields be zeroed, and gcc obeys the standard.

    You could use diagnostic pragmas like

    #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
    

    But my feeling is that you should code with care, and explicitly initialize all the fields. The warning you get is more a coding style warning (maybe you forgot a field!) than a bug warning.

    I also believe that for your own (public) struct you should #define an initializing macro, if such struct are intended to be initialized.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code Snippet: target_test : test.cc $(CXX) $(CPPFLAGS) $(CFLAGS) test.cc I know that CXX is
Code: <?php //initializing script, do not modify session_start(); define('IN_SCRIPT', true); //so that global.php cannot
I would like to know if the following is possible in SQL server 2005.
Code for webpage such that if anyone closes it, then next time when he
Code duplication is usually bad and often quite easy to spot. I suppose that
Code (Note that the result will not display properly without the images referenced) I'm
Code: digits.each do |digit| puts digit.content #&0000000000032056.00000032 056 value = digit.content[24..-1].strip puts value #32
code as following: \#define CS 0x18 asm (pushl CS ); or something as an
I have written this code to get the G value from UIAccelerometer in xcode.
I have multiple Code Tables at the bottom of the XML that I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.