 | Cx51 User's Guide |  |
|
|
| FARWARNING Compiler Directive| Abbreviation | FW | | Arguments | None. | | Default | None. | | µVision | Options — C51 — Misc Controls. | | Description | The FARWARNING directive enables extra warnings when an address calculation with far variables only affects the offset part (lower 16-bit of an address. This directive has been implemented to allow checking of code that should address the complete 24-bit address space. | | Example |
#pragma O2 VARBANKING
char far *cp;
int far *ip;
int i;
int far fa2[10][10];
char far ca2[10][10];
#pragma FARWARNING
void test1 (void) {
cp = &ca2[i][0];
cp = &ca2[(long)i][10L];
i = fa2 [i][0];
i = fa2 [(long)i][2];
i = fa2 [(long)i][1L];
cp++; // warning C287 issued
--cp; // warning C287 issued
cp += 1; // warning C287 issued
cp += 1L; // no warning, full 24-bit address calculation
cp -= 1; // warning C287 issued
cp -= 1L; // no warning, full 24-bit address calculation
ip += 2; // warning C287 issued
ip -= 2; // warning C287 issued
ip += 2L; // no warning, full 24-bit address calculation
ip -= 2L; // no warning, full 24-bit address calculation
ip[(unsigned long)*cp] = 0; // no warning, full 24-bit address calculation
ip[*cp] = 0; // warning C287 issued
i = ip[5]; // warning C287 issued
i = ip[5L]; // no warning, full 24-bit address calculation
}
|
|
|