X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Paul Wilkins User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: assembly code of the "strange error" - program References: <20040727070949 DOT 29244 DOT 00000306 AT mb-m19 DOT aol DOT com> <200407271306 DOT i6RD6e8o010681 AT envy DOT delorie DOT com> <200407271836 DOT i6RIa5vk015726 AT envy DOT delorie DOT com> In-Reply-To: <200407271836.i6RIa5vk015726@envy.delorie.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 29 Message-ID: Date: Wed, 28 Jul 2004 17:17:56 +1200 NNTP-Posting-Host: 218.101.50.29 X-Complaints-To: abuse AT tsnz DOT net X-Trace: news02.tsnz.net 1090992011 218.101.50.29 (Wed, 28 Jul 2004 17:20:11 NZST) NNTP-Posting-Date: Wed, 28 Jul 2004 17:20:11 NZST Organization: TelstraClear To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com DJ Delorie wrote: >>>No, it sets it to 0x04040404. >> >>So long as it's an int array, where is the difference? Is it in my >>understanding of potential implications? > > > It makes a difference if you expected each U[i] to be the value 4. As I'm expecting memset to accept ints in the middle value there should be no difference. > I'm just trying to avoid confusion... the original code: > >>>>int U[99]; memset(U, 4, sizeof(U)); > > fills each BYTE in the memory range with the BYTE 0x04, but it does > not fill each ELEMENT of the array with the VALUE 4. I could've sworn that memset used INT, not BYTE, for the middle element, so memset would fill the memory range with the integer number 4, and as U[] is also defined as INT there shouldn't be any trouble such as what you speak of, no? > Yeah, it's just a picky semantic issue, but if it keeps at least one > newbie from making this mistake it will be worth the effort ;-) -- Paul Wilkins