For Programmers: Free Programming Magazines  


Home > Archive > C > September 2005 > Re: A[x][y][z]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: A[x][y][z]
Chris Dollin

2005-09-29, 6:55 pm

sterten@aol.com wrote:

> it's awful in C with multi-dimension arrays.


If you say so.

> A[x][y][z] is worse than A[x,y,z] ,


Is it?

> is someone successfully running the C-compiler from batch-file,
> first converting all of the latter expressions
> into the corresponding former ones and then compiling it ?
>
> And while we're at it, this preprocessing utility should
> also change array definitions like e.g.
> int B[N];
> into int B[N+1];
> since B[N] would not be defined else, only B[0],B[1],..,B[N-1]


My advice would be to write the code correctly in the first place.
`int B[N]` defines an N-element array. It just has weird indexing.
You may think - I certainly do - that 0-based indexing is the work
of the devil, but that is the choice made for C, and you're better
off working with it (and hence not contrary to the usual behaviour
of those here who might help you) than against it.

--
Chris "am I troll-caught?" Dollin
The software engineer's song: "who knows where the time goes".
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com