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


Groups > comp.lang.c > #18262

Re: Getting rid of warnings

Message-ID <4F560AF6.40402@loria.fr> (permalink)
Date 2012-03-06 14:02 +0100
From Jens Gustedt <jens.gustedt@loria.fr>
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>
Organization Guest of ProXad - France

Show all headers | 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