C++ Primer 第四版课后练习解答 习题1.7
注意:本随笔是在《C++Primer(第四版)习题解答(完整版)》中直接抄录的。此处主要是便于本人以后反复阅读。
习题1.7
编译有不正确嵌套注释的程序。
【解答】
#include <iostream> /* *comment pairs/* */ cannot nest. *"cannot nest" is considered source code, *as is the rest of the program */ int main() { return 0; }
编译器给出的错误
error C2146: 语法错误: 缺少“;”(在标识符“nest”的前面)
error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
error C2143: 语法错误 : 缺少“;”(在“.”的前面)
warning C4138: 在注释外找到“*/”
error C2143: 语法错误 : 缺少“;”(在“{”的前面)
error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
本人用VS2013给出的结果如上。