Re: Array initalization doubt.
From: dandelion (dandelion_at_meadow.net)
Date: 10/26/04
- Next message: Foobarius Frobinium: "Re: Pointer Guide Nearing Completion"
- Previous message: Michael Mair: "Re: How to generate all possible permutations with repetitions?"
- In reply to: Jack Klein: "Re: Array initalization doubt."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 17:05:57 +0200
"Jack Klein" <jackklein@spamcop.net> wrote in message
news:kadrn0pcg3epoovo5lpgff90um26p0hdk6@4ax.com...
> On Mon, 25 Oct 2004 14:43:21 +0200, "dandelion" <dandelion@meadow.net>
> wrote in comp.lang.c:
>
> >
> > "K.M. Jr." <km_jr_usenet@yahoo.com> wrote in message
> > news:7f8bb583.0410250237.7ddc4f7f@posting.google.com...
> > > Hi all,
> > >
> > > Consider this line -
> > >
> > > char s[30] = "\0";
> > >
> > > Does this initialize all array elements to zero ?
> >
> > The standards guys will answer that definitively. My guess is a
resounding
> > "no" in the sense that I would not count on it. I think only s[0] gets
> > initialized.
>
> You don't have to count on it, but the answer is most definitely
> 'yes'.
I noticed.
I still don't count on it for two reasons:
a) If I initialize a structure, I initialize it fully for the sake of
clarity of code.
b) I've had one expirience too much of compiler which *almost* but *not*
quite implement the
entire standard. "Oops... Shit... Sorry. There's a section in the manual
about it on page 652! You
should have read that."
Neither of these reasons is a critique of either the standard, nor the guys
(and that includes you) explaining it, but merely reflects my style of
programming in which clarity of code plays a much more important role than
saving a few characters (or even lines) of code.
- Next message: Foobarius Frobinium: "Re: Pointer Guide Nearing Completion"
- Previous message: Michael Mair: "Re: How to generate all possible permutations with repetitions?"
- In reply to: Jack Klein: "Re: Array initalization doubt."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|