Re^2: Using small memory model functions on huge arrays (was See below...)
Mike Percy
grimlok at hubcap.clemson.edu
Wed May 30 03:04:52 AEST 1990
darcy at druid.uucp (D'Arcy J.M. Cain) writes:
[stuff about mixed mode strcpy]
>#define mixstrcpy(d, s) { int k = 0; do d[k] = s[k]; while (s[k++]);}
>At that point it is probably just as easy to put it inline any way. I
>tested the above on Unix but it should work on brain dead OS's as well.
With one, possibly trivial, problem. As I have pointed out here before,
unless d and s are both huge pointers, the [] operators will fail when
used to address items whose byte offset from &array[0] is greater than
64K (we are talking about Intel here, after all). This might need to
be
#define mixstrcpy(d, s) \
{ \
while(*(char huge *)d++ = *(char huge *)s++); \
}
We have to use huge; far isn't sufficient, as it wraps around in its segment.
But again, unles you know you have really mongo large structures, avoid
using huge and incurring its overhead.
More information about the Comp.lang.c
mailing list