Zortech "limitation"
Peter Nelson
nelson_p at apollo.HP.COM
Mon Feb 12 06:59:00 AEST 1990
I received a number of responses to my query about how to
allocate large, global 2-dimensional arrays in Zortech C++,
where no individual array would be > 64K but the total
space involved for all of them would exceed 64K. One
of my requirements is that I can access them as 2-dimensional
arrays and not have to access them via pointer arithmetic.
Most of them involved extensive use of malloc and pointers.
The whole idea of using a high-level language in the first
place is to make the architectural ideosyncracies of the
machine INVISIBLE to the user and allow the user to express
the program in terms of his problem. In my case that means
2 dimensional arrays.
There is no **technical reason** why the Zortech compiler
can't allow you to allocate arbitrarily large amounts of
global memory, up to the limitations of available RAM, and
simply manipulate the DS register to access it. Sure, there's
more overhead, but the manual already warns the user that the
use of the C or L memory models is less efficient, so we
must presume that the user is willing to pay that price.
On a virtual memory machine I know that if I allocate
an array that exceeds the size of my available physical
RAM I'm going to pay a huge performance penalty due to
paging. But if I'm willing to live with that then I
don't have to write my program any differently.
80x86 machines have their segmented architecture but virtually
ALL computers have lots of addressing modes and different length
address or offset registers, with different numbers of ticks
required to execute them. But our C compilers here at work don't
ask me what addressing modes or register sizes to use. Hell,
I don't have to even worry about rewriting my program when
I go from, say, a 68030 platform to an Apollo DN10000 (RISC).
If I *want* to tune the program I have large selection of
options, but I'm not forced to use them.
With the Zortech product, as well as some other DOS products,
I apparently have to return to those "golden days of yesteryear"
and be a hobbyist hacker again. And I thought I'd paid those
dues and graduated to software adulthood already.
---Peter
More information about the Comp.lang.c
mailing list