mathe 发表于 2012-4-18 13:17:34

不过这个例子里面,由于字符串a_str的内容会被修改,所以编译器通常无法知道串长度不会发生变化,所以不会优化

wayne 发表于 2012-4-18 14:00:52

11# mathe
如果 a_str是const类型,编译器是不是 就会优化了

mathe 发表于 2012-4-18 14:34:39

很多编译器可以
页: 1 [2]
查看完整版本: 关于for循环的strlen