While starting to work with Dynamic C 10.09 (the version shipping with RabbitCore 4200), I found two very strange compiler problem with far pointers, illustrated in the small program below.
I already found how to work around these by adding dummy lines of code or dummy variables, but I was wondering if these are known issues fixed in a later version of the compiler ?
/* Sample program to show some strange problems with far variables.
- Problems seen with Dynamic C Version 10.09
*/
static const far char FAR_STR[] = “hello world”;
/*
- Problem 1: defining a far char * in a structure just after an array cause
-
it to be handled as a non-far pointer afterwards, in code
-
checking as well as in code generation.
*/
struct {
char arr_a[2];
int x;
const far char *str_a;
char arr_b[2];
const far char *str_b;
} mystruct;
main()
{
mystruct.str_a = FAR_STR;
mystruct.str_b = FAR_STR; // this line is improperly handled
}
/*
- Problem 2: returning a NULL pointer in a far char * function cause a
-
compiler internal later in the compilation of the function.
*/
far char *rcGrowPtrOfs(int input)
{
far char *res;
if(input == 0) {
res = NULL;
return NULL; // this cause an internal error below / "return res;" works
}
return FAR_STR;
}