Is the backslash acceptable in C and C++ #include directives?

后端 未结 6 1369
有刺的猬
有刺的猬 2020-11-27 17:22

There are two path separators in common use: the Unix forward-slash and the DOS backslash. Rest in peace, Classic Mac colon. If used in an #include dir

6条回答
  •  孤独总比滥情好
    2020-11-27 17:54

    Blackslash is undefined behavior and even with a slash you have to be careful. The C99 standard states:

    If the characters ', \, ", //, or /* occur in the sequence between the < and > delimiters, the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the sequence between the " delimiters, the behavior is undefined.

提交回复
热议问题