comp.lang.c
[Top] [All Lists]

Re: Clearing Padding in Structure

Subject: Re: Clearing Padding in Structure
From: Martin
Date: Wed, 26 Mar 2008 11:29:13 -0000
Newsgroups: comp.lang.c


On Tue, 25 Mar 2008 00:18:27 -0000, user923005 <dcorbit@xxxxxxxxx> wrote:
If you want to be fully portable, assign {0} to the struct instance on
declaration and it has to properly initialize all members (including
floating point and pointers).  Or you can keep one of these laying
around:

static const struct mystruct gmystruct_zero_initializer = {0};

and use that subsequently to initialize things.

Thanks for that user923005, Peter Nilsson has provided a similar suggestion.

--
Martin


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy