C251 User's Guide

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.

OptionDescription
CODEImplicit strings are located in code space. This is the default setting of the C251 Compiler.
XDATAImplicit 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)