引言 之前在windows中写const的总结, 在vs17中测试代码, 结果在测试字符串面值时出现了意料之外的错误. 问题 char *str = "vs2017"; 这行代码在gcc中能够通过编译, 只是有一个警告 : warning: ISO C++ forbids converting a string constant to char* [-Wwrite-strings] 但是在vs中却不能通过编译, 错误 : 所以同样我在做const与typedef的问题上, vs已无法编译通过, 例子如下 : typedef char * type; const type str