C言語におけるバックスラッシュ
2つめのバックスラッシュの話で、例えば以下のコードは何も実行しない
int main() { // comment \ printf("hoge\n"); }
なんだけども、これは仕様なのか。
2. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
3. The source file is decomposed into preprocessing tokens and sequences of white-space characters (including comments). A source file shall not end in a partial preprocessing token or in a partial comment. Each comment is replaced by one space character. New-line characters are retained. Whether each nonempty sequence of white-space characters other than new-line is retained or replaced by one space character is implementation-defined.
バックスラッシュの直後にある改行は削除されたあとに、コメントがスペースに変換されるのでなにもしないことになってしまう
まあ、バックスラッシュの後にスペース入れておけば大丈夫なんだけども