delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/08/02/02:16:07.2

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <410D7A24.1306F0C1@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: assembly code of the "strange error" - program
References: <WcpNc.640$zS6 DOT 86489 AT news02 DOT tsnz DOT net> <20040727070949 DOT 29244 DOT 00000306 AT mb-m19 DOT aol DOT com> <pnxNc.667$zS6 DOT 95084 AT news02 DOT tsnz DOT net>
Lines: 32
Date: Mon, 02 Aug 2004 06:02:41 GMT
NNTP-Posting-Host: 12.76.143.54
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc05-news.ops.worldnet.att.net 1091426561 12.76.143.54 (Mon, 02 Aug 2004 06:02:41 GMT)
NNTP-Posting-Date: Mon, 02 Aug 2004 06:02:41 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Paul Wilkins wrote:
> Sterten wrote:
> 
... snip ...
>>
>> I was told, they were set to zero ?
> 
> My C manual says otherwise.
> 
>  "If you do not initialize any elements of an array, the compiler
>   will NOT implicitly set all elements to 0. C does not specify
>   that the compiler automatically initialize all variables and
>   arrays. The values of an array are undetermined unless you
>   initialize it either in the definition statement or by explicit
>   assignment."
> 
> There may be a compiler that does initialise them to 0, but you
> can't guarantee that every compiler will do so, so play it safe
> and work on the worst case scenario.

That applies to automatic and malloced storage.  static storage is
guaranteed to be initialized to 'all bytes zero' barring explicit
other initialization.  Read the C standard.  That is why it
exists.

-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019