News for hackers. Stuff that matters.
Re:C's designated initializers give us named arguments by cozzyd on Thursday November 19, 2026 @09:49AM (#50560853)
The idiom I usually use is to define a DEFAULT_FOO_PARAMS like

  struct foo { int Z; int A; double E, double v }; 
  #define DEFAULT_FOO_PARAMS  .Z = 1, v = 3e8 

  struct foo f = { DEFAULT_FOO_PARAMS, .Z  =2, .A = 4, .E = 1 }

But I do sort of wish there was a language-supported way to set defaults for a designated initializer in the struct definition (like C++ default values) to avoid having to write DEFAULT_FOO_PARAMS there.

There are no comments on this comment yet.