Keil Logo

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
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.