在使用gcc編譯代碼時(shí)出現(xiàn)了一個(gè)warning,no newline at end of file ,具體原因是因?yàn)樵谖募脖仨毜男略鲆恍锌招校员苊鈏nclude文件時(shí),展開(kāi)后與后面的文件連為一行,造成錯(cuò)誤。C++文檔中有明確說(shuō)名。唉,vs就從來(lái)沒(méi)有提醒過(guò),難道是換行符的區(qū)別?
A source file that is not empty and that does not end in a new-line character, or that ends in a new-line character immediately preceded by a backslash character before any such splicing takes place, shall be processed as if an additional new-line character were appended to the file (C++11 §2.2/1)