designated inits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Referring to section 5.21 of the docs - Designated Initializers

typedef struct
{
   int a;
   int b;
} foo;

Is there a way I can get this effect

foo myfoo = { .a = 0, .b = 0 };

without specifying each field? I just want the whole structure
initialized to zero.

Note: if I just do this

foo myfoo;

then I get 'use of uninitialized value' errors in valgrind.

Thanks,

-Todd


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux