各位读者,很抱歉这篇文章是英文的,我当初做笔记的时候,写成英文了,这样才可以在同事之间交流。
而现在确实没时间翻译过来了,还望大家理解,谢谢!
If your code builds well using gcc4.3 and below, it may not build
with gcc4.4, which was released in April 2009.
Following are some of the changes that violates c/c++ standard:
1. gcc4.4 does not by default #include stdio.h, or stdlib.h, no
header files are by default included, all header files of
standard c/c++ libraries need to be explicitly included.
2. More warning checks, e.g. if/else partitions.
This code snippet:
if (a)
if (b)
do something here;
else
do something else here;
will cause warnings, you need this:
if (a) {
if (b)
do something here;
else
do something else here;
}
3. Stricter enum checks.
Basically we can not rely on the
rules to evaluate enum members to integers which were
true before; we can not use the integer values of enum
members, we can only use the literal enum members. For
example, we can not use them to compare with integral
values, or members of another enum type. We can only
compare with other enum members of the same type for equality.
4. Use standard ansi c++ include
For C library header files, #include <cstdio> rather than #include <stdio.h>;
And also need to "use namespace std;" because all C functions are put into the
std namespace.
This item is not required now, but since it is standard c++
we should follow it and abandon the old fashion in case some day later our
code fails to build with latest c++ compiler.
gcc4.4 issues
最新推荐文章于 2021-04-03 19:17:00 发布