Missing initializer

Hello everyone.

I have this code:

static void
finance_application_startup (GApplication *application)
  const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
  static const GActionEntry app_actions[] = {
    { "about_dialog" , finance_app_about_action, NULL, NULL, NULL },
    { "quit" , finance_app_quit_action, NULL, NULL, NULL },
  g_action_map_add_action_entries (G_ACTION_MAP (application),
                                   G_N_ELEMENTS (app_actions),
  G_APPLICATION_CLASS (finance_application_parent_class)->startup (application);
  gtk_application_set_accels_for_action (GTK_APPLICATION (application),

And this warning:

missing initializer for field padding of GActionEntry.

Everything is working correctly, but can someone explain to me why this message is appearing.

GActionEntry has extra “padding” fields which might be used in the future if more functionality is needed. The padding is present so that the struct size remains the same in that case. You don’t need to initialize these fields.

I’d recommend either using C designated initializers, or switching off this warning.

1 Like

Thank you so much for your answer.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.