delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/04/23/12:30:15

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <40894148.73D9AF8A@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: Trouble of using very large arrays
References: <c68d6j$g57$03$1 AT news DOT t-online DOT com> <c68e70$96gqq$1 AT ID-231750 DOT news DOT uni-berlin DOT de> <c68u9l$9fevb$1 AT ID-79865 DOT news DOT uni-berlin DOT de> <urih80l3b6om4kbblr8jthpjbm1i7cp6gc AT 4ax DOT com> <4088E94D DOT 8070508 AT acm DOT org>
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.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


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