-Pe: Do Not Preprocess Escape Sequences in Strings with Absolute DOS Paths

Group

LANGUAGE

Scope

Compilation Unit

Syntax
  -Pe
  
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

If escape sequences are used in macros, they are handled in an include directive similar to the way they are handled in a printf() instruction:

  #define STRING "C:\myfile.h"
  
  
  #include STRING
  
  

produces an error:

  >> Illegal escape sequence
  
  

but used in:

  printf(STRING);
  
  
  produces a carriage return with line feed:
  
  
  C:
  
  
  myfile
  
  

If the -Pe option is used, escape sequences are ignored in strings that contain a DOS drive letter ('a - 'z', 'A' - 'Z') followed by a colon ' :' and a backslash ' \'.

When the -Pe option is enabled, the Compiler handles strings in include directives differently from other strings. Escape sequences in include directive strings are not evaluated.

The following example:

  #include "C:\names.h"
  
  

results in exactly the same include filename as in the source file (" C:\names.h"). If the filename appears in a macro, the Compiler does not distinguish between filename usage and normal string usage with escape sequence. This occurs because the STRING macro has to be the same for both the include and the printf() call, as shown below:

  #define STRING "C:\n.h"
  
  
  #include STRING /* means: "C:\n.h" *
  
  
  void main(void) {
  
  
    printf(STRING);/* means: "C:", new line and ".h" */
  
  
  }
  
  

This option may be used to use macros for include files. This prevents escape sequence scanning in strings if the string starts with a DOS drive letter ( a through z or A through Z) followed by a colon ':' and a backslash '\'. With the option set, the above example includes the C:\n.h file and calls printf() with "C:\n.h").

Example
  -Pe