Menu

Escaping Characters in file names

Tom Hunt
2008-05-23
2013-05-28
  • Tom Hunt

    Tom Hunt - 2008-05-23

    On Linux using 2.7.1 release if i have a file called 'escape"me' and preprocess the file it generates the following #line directive

    #line 1 "/home/tom/Desktop/mcpp-2.7.1/src/escape"me"

    with gcc it generates

    # 1 "escape\"me"

    which has the double quote in the middle escaped.

    is this intended or is it a bug?

    Tom

     
    • Kiyoshi Matsui

      Kiyoshi Matsui - 2008-05-24

      MCPP simply does not support such a quirk of filename.  Does it have any meaning in real world programs?

      Though GCC emits the line at 'escape"me':

      # 1 "escape\"me"

      , it emits an error on the source "inc_esc.c":

      #include "escape\"me"

      as:

      inc_esc.c:1:19: warning: extra tokens at end of #include directive
      inc_esc.c:1:22: error: escape\: No such file or directory

      Anyway, I don't think it has any meaning for a preprocessor to support such an obfuscated code.

       
    • Tom Hunt

      Tom Hunt - 2008-05-27

      Although i see no real reason to use a file name with such a character it is an allowed file name by the Linux operating system and therefore should be allowed in a tool chain in my opinion.

       

Log in to post a comment.