Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #18262

Re: Getting rid of warnings

Path csiph.com!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!cleanfeed4-a.proxad.net!nnrp6-2.free.fr!not-for-mail
Message-ID <4F560AF6.40402@loria.fr> (permalink)
Date Tue, 06 Mar 2012 14:02:46 +0100
From Jens Gustedt <jens.gustedt@loria.fr>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: Getting rid of warnings
References <jj21a3$alt$1@ccpntc8.in2p3.fr> <8gtg29-od7.ln1@voyager.wichi.de.vu> <jj50qs$qmm$1@ccpntc8.in2p3.fr>
In-Reply-To <jj50qs$qmm$1@ccpntc8.in2p3.fr>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Lines 26
Organization Guest of ProXad - France
NNTP-Posting-Date 06 Mar 2012 14:02:32 MET
NNTP-Posting-Host 152.81.5.236
X-Trace 1331038952 news-4.free.fr 13027 152.81.5.236:54502
X-Complaints-To abuse@proxad.net
Xref csiph.com comp.lang.c:18262

Show key headers only | View raw


Am 03/06/2012 01:44 PM, schrieb Guillaume Dargaud:
> Markus Wichmann wrote:
> 
>> And, by the way, why don't you just replace that last line with
>> i = Idx[NbTraces - 1];
> 
> Actually the loop does other things which I left out.
> 
> 
> Ike Naar wrote:
> 
>> Does it help if you replace the two lines above by
>>   int i, Idx[MAX_TRACES] = {0};
> 
> Yes it does go away and I'm surprised ! I thought I would have to set 
> {0,0,...} but since I didn't know the value of MAX_TRACES, that wasn't 
> possible.
> Does this syntax means that only the 1st element is set to 0 or all of them?

No, all elements that are not explicitly mentioned in an initializer are
always initialized by 0

In fact the above initializer { 0 } works for any type of array (and
other variable) as long as MAX_TRACES is a compile time integer constant.

Jens

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Getting rid of warnings Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-03-05 10:33 +0100
  Re: Getting rid of warnings Ike Naar <ike@iceland.freeshell.org> - 2012-03-05 11:16 +0000
  Re: Getting rid of warnings Barry Schwarz <schwarz45@yahoo.com> - 2012-03-05 13:22 -0800
  Re: Getting rid of warnings Markus Wichmann <nullplan@gmx.net> - 2012-03-06 09:12 +0100
    Re: Getting rid of warnings Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-03-06 13:44 +0100
      Re: Getting rid of warnings Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-06 14:02 +0100
        Re: Getting rid of warnings Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-06 17:17 +0000
          Re: Getting rid of warnings Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-06 22:43 +0100
            Re: Getting rid of warnings Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-06 22:49 +0000
      Re: Getting rid of warnings James Kuyper <jameskuyper@verizon.net> - 2012-03-06 08:04 -0500
        Re: Getting rid of warnings Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> - 2012-03-13 10:59 +0100
      Re: Getting rid of warnings Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-06 08:27 -0500

csiph-web