X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <40894148.73D9AF8A@yahoo.com> From: CBFalconer 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: Trouble of using very large arrays References: <4088E94D DOT 8070508 AT acm DOT org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 26 Date: Fri, 23 Apr 2004 16:29:13 GMT NNTP-Posting-Host: 12.76.145.84 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1082737753 12.76.145.84 (Fri, 23 Apr 2004 16:29:13 GMT) NNTP-Posting-Date: Fri, 23 Apr 2004 16:29:13 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Cesar Rabak wrote: > Brian Inglis escreveu: > ... snip ... >> >> -- avoid using types for sizes, in case someone later changes >> the assigned pointer type; use object sizes instead; >> >> this is cleaner and more maintainable: >> >> a = malloc(rows * columns * sizeof *a); >> > This is not a good advice: you're changing the allocation of > an object of (rows x columns) ints to another of (rows x > columns) pointers to int. On the contrary, that was excellent advice. It slaves the allocation to what is actually being allocated. If it is not what you want you have misdeclared a. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!