Article View: comp.std.c
Article #4605Re: int's and zero
From: Alan Stokes
Date: Wed, 10 Jan 1996 12:15
Date: Wed, 10 Jan 1996 12:15
19 lines
845 bytes
845 bytes
In <4ctkfa$1fj0@info4.rus.uni-stuttgart.de> schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt) writes:
>In article <4cth4e$4q@odin.funcom.no>,
>there is an (elegant, IMHO) way to initialize structures
>as if you had written <member> = 0 for any member.
Yes, there is, but it's not the way you suggest. How about:
void
foo (void)
{
struct intstruct { ... } bar = { 0 };
/* Much more readable than memset(&bar, 0, sizeof bar); */
}
--
Alan Stokes (alan@rcp.co.uk)
RCP Consultants Ltd
Didcot, UK
Technical Details
Message-ID:
<BR-8wAWLBh107h@rcp.co.uk>Path:
arc1-ca.pugleaf.net!kate.ibmpcug.co.uk!rcp!alanReferences:
<4cth4e$4q@odin.funcom.no> <4ctkfa$1fj0@info4.rus.uni-stuttgart.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!kate.ibmpcug.co.uk!rcp!alan From: alan@rcp.co.uk (Alan Stokes) Newsgroups: comp.std.c Subject: Re: int's and zero Message-ID: <BR-8wAWLBh107h@rcp.co.uk> Date: Wed, 10 Jan 96 12:15:45 GMT References: <4cth4e$4q@odin.funcom.no> <4ctkfa$1fj0@info4.rus.uni-stuttgart.de> Organization: RCP Consultants Ltd.