delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/27/14:36:16

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Tue, 27 Jul 2004 14:36:05 -0400
Message-Id: <200407271836.i6RIa5vk015726@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <FaxNc.666$zS6.94831@news02.tsnz.net> (message from Paul Wilkins
on Wed, 28 Jul 2004 06:28:14 +1200)
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> <200407271306 DOT i6RD6e8o010681 AT envy DOT delorie DOT com> <FaxNc.666$zS6 DOT 94831 AT news02 DOT tsnz DOT net>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> > 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.

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.

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 ;-)

- Raw text -


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