Zortech "limitation"
Kent Williams
williams at umaxc.weeg.uiowa.edu
Wed Feb 14 01:08:36 AEST 1990
C'mon, dude. We all know the Intel Processors are brain-damaged. This is
pretty old news. Besides, what's the big deal about calling malloc to build
a >64K two-dimensional array? On the PC, the code generated is going to
be better than if Walter did you the 'favor' of giving you huge arrays.
So you just do something like:
something **huge_array = (something **)malloc(N*sizeof(something *));
for(int i = 0; i < N; i++)
huge_array[i] = (something *)malloc(sizeof(something)*M);
And the normal array subscripting semantics apply, TRANSPARENTLY, AS THOUGH
THIS WERE A LANGUAGE FEATURE PUT THERE TO MAKE THINGS EASY FOR THE PROGRAMMER!
How about that?
In this case the code generated is something like:
something& access(i,j) {
basereg = *(huge_array + i)
indexreg = j * sizeof(something);
return *(basereg + indexreg);
}
Whereas if you had huge arrays its something like:
something& access(i,j) {
basereg = hideous_segment_calculation(huge_array,i);
indexreg = hideous_segment_calculation(basereg,j);
}
Which would you rather have under the hood?
--
Kent Williams "What's an Address Bus? How do Icons work?"
williams at umaxc.weeg.uiowa.edu -- Advertisement for Time-Life Books
More information about the Comp.lang.c
mailing list