Diffrence between "/" and "\"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shoonya
    New Member
    • May 2007
    • 160

    #1

    Diffrence between "/" and "\"

    Hi,

    What is the diffrence between below 2 lines. Both the codes are working fine in my project using ARM compiler.

    Code:
    1. #include "abc/foo.h"
    2. #include "abc\foo.h"
    -Shoonya
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    It's defined by platform the compiler runs on. Windows understands both, but the one with backslashes may not compile on linux.

    Comment

    • shoonya
      New Member
      • May 2007
      • 160

      #3
      @newb16

      Thanks :)

      -Shoonya

      Comment

      • donbock
        Recognized Expert Top Contributor
        • Mar 2008
        • 2427

        #4
        newb16 is right, the particular syntax used to specify pathnames is implementation-specific. However, I'm surprised "abc\foo.h" worked. I would have guessed that the sequence "\f" would have been replaced by the single nonprintable formfeed character -- at least that is what would happen if that string appeared in a line of C source code. In this case, the string appears in a line of preprocessor code. Perhaps the rules for parsing text are different there.

        According to Harbison & Steele (C Reference Manual), "the file name is subject to trigraph replacement in Standard C and source-line continuation, but no other processing of the characters occurs."

        Comment

        Working...