#include file paths. '/' or '\'?
I am going to have to ask this since this has been bugging me to no end. Which slash should be used to include files? '../foo.h' or '..\foo.h'? Does it matter which one I use and if it does, please list the reasons why.
Thanks.
You should use forward slash I think. This will work across compilers platforms (Linux, Windows etc.) whereas a backward slash only works on Windows.
* This may be completly wrong, I just remember reading it at some point. * :)
* This may be completly wrong, I just remember reading it at some point. * :)
All C preprocessors understand forward slashes, even on platforms that use a backslash or a colon as the path separator.
Quote:Original post by yaustar
I am going to have to ask this since this has been bugging me to no end. Which slash should be used to include files? '../foo.h' or '..\foo.h'? Does it matter which one I use and if it does, please list the reasons why.
Thanks.
Reiterating what Fruny said ... always use "/" because it is correct on any platform.
Yup. I'd like to add this quote from the Holy One, section 2.8 (Header names) §2:
So yes, prefer / since it is guaranteed to work.
Regards,
Quote:
If either of the characters ' or \, or either of the character sequences /* or // appears in a q-char-sequence or a h-char-sequence, or the character " appears in a h-char-sequence, the behavior is undefined.
So yes, prefer / since it is guaranteed to work.
Regards,
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement