delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/08/06/00:12:06

From: jbs30000 AT aol DOT com (Joel)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ignore this post
Date: 5 Aug 2003 20:34:19 -0700
Organization: http://groups.google.com/
Lines: 40
Message-ID: <84e4e2a9.0308051934.5daed4a2@posting.google.com>
References: <84e4e2a9 DOT 0308042001 DOT 6f4d7231 AT posting DOT google DOT com> <20030805022123 DOT 16575 DOT 00000008 AT mb-m25 DOT aol DOT com> <bgntiv$5oq$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: 172.169.6.219
X-Trace: posting.google.com 1060140860 18382 127.0.0.1 (6 Aug 2003 03:34:20 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 6 Aug 2003 03:34:20 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote in message news:<bgntiv$5oq$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>...
> JBS30000 <jbs30000 AT aol DOT com> wrote:
> 
> > I figured out the problem.  The array goes 0-5, 0-6, 0-5 but I was
> > supposed to put unsigned char Dither[6][7][6]; Like I said, the
> > answer was very obvious.  Sorry about that.
> 
> Nothing to be sorry about.  Here's another suggestion to improve the quality 
> of that source code a bit:
> 
> 1) lose those tons of commented-out numbers.  They really make the
> code hard to read for no apparent gain.
> 
> 2) You have an array of arrays of arrays of numbers, here, but your
> initializer doesn't reflect that.  The language does allow the way you
> did it, overflowing from one sub-array into the next, but it's not
> particularly good style.  Instead, consider
> 
> 	unsigned char Dither [6][7][6] = {
>            { { first sub-sub-array}, 
>              { second sub-sub-array} },
>            { {first sub-sub-array in second sub-array},
> 	     { ... } },
> 	   { ... }
> 	};
> 
> The indentation is just visual sugar, but the additional pairs of { }
> provide real value --- they'll make it harder to miscount entries
> inside the array.

Thanks.  Oh, and for the record, Joel is what's used as my name if I'm
posting on Google Groups and JBS30000 is what will show up as my name
if I post in
http://www.cs.berkeley.edu/Newspages/comp.os.msdos.html
Anyway, the commentented out numbers are for me and do have a reason
for being there.  As for your second point, thanks, I'll give it a
try.  I haven't made too many programs using multi dimension arrays
and wasn't aware of the proper way to initialize them.  I just figured
that  6 * 7 * 6 = 252 so if I initalized the array with 252 elements
there would be no problem.

- Raw text -


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