Keil Logo

STRING Compiler Directive

Abbreviation

None.

Arguments

(CODE), (XDATA), (FAR), or (HUGE)

Default

STRING (CODE)

µVision

Options — C251 — Misc controls.

Description

The STRING directive specifies the memory type used for implicit strings. By default, implicit strings are located in code memory. For example:

void main (void) {
  printf ("hello world\n");
}

in this example, the string "hello world" is located in code memory.

The STRING directive changes the default location for implicitly located strings. This directive must be used carefully, since existing programs might use memory typed pointers to access strings.

Option Description
CODE Implicit strings are located in code space. This is the default setting of the C251 Compiler.
XDATA Implicit strings are located in const xdata space.
FAR
HUGE
Implicit strings are located in const far space.

Note

  • The options FAR and HUGE are identical.
Example
C251 SAMPLE.C STRING (XDATA)

#pragma STRING (FAR)
  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.