gcc4.4 issues

各位读者,很抱歉这篇文章是英文的,我当初做笔记的时候,写成英文了,这样才可以在同事之间交流。
而现在确实没时间翻译过来了,还望大家理解,谢谢!

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值