什么gcc选项保证更多的可移植C代码 [英] What gcc options guarantee more portable C code

查看:64
本文介绍了什么gcc选项保证更多的可移植C代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gcc上,哪个版本的C标准最合规:-c89,-ansi

或c99?对于更便携的C代码,哪些选项应用于

编译?


以下选项可以保证最便携的C代码

不同的环境?


gcc -ansi -pedantic -Wall test.c

-

lovecreatesbeauty

On gcc, which version of C standard has the most compliant: -c89, -ansi
or c99? For more portable C code, which options should be applied to
compilation?

Can the following options guarantee the most portable C code for
different environment?

gcc -ansi -pedantic -Wall test.c
--
lovecreatesbeauty

推荐答案

Le 15-06-2006,lovecreatesbeauty< lo *************** @ gmail .COM> aécrit*:
Le 15-06-2006, lovecreatesbeauty <lo***************@gmail.com> a écrit*:
在gcc上,哪个版本的C标准最合规:-c89,-ansi
或c99?对于更便携的C代码,应该将哪些选项应用于编译?

以下选项可以保证最便携的C代码适用于不同的环境吗?

gcc -ansi -pedantic -Wall test.c
On gcc, which version of C standard has the most compliant: -c89, -ansi
or c99? For more portable C code, which options should be applied to
compilation?

Can the following options guarantee the most portable C code for
different environment?

gcc -ansi -pedantic -Wall test.c




你不能阅读GCC的文档吗?

编译c89代码,选项是-std = c89。

支持c99今天不通用,因此,当看到

''portability''时,你可以限制自己c89。


其他选项可以在编译代码时警告你

gcc发现可疑。


Marc Boyer



Can''t you read the documentation of GCC ?
To compile c89 code, the option is -std=c89.
Support of c99 is not universal today, so, when looking at
''portability'', you could restrict yourself to c89.

Other options are there to warn you when you compile some code
that gcc find suspect.

Marc Boyer


lovecreatesbeauty写道:
lovecreatesbeauty wrote:

.... snip ...以下选项可以保证最便携的C代码为
不同的环境?

gcc -ansi -pedantic -Wall test.c
.... snip ... Can the following options guarantee the most portable C code for
different environment?

gcc -ansi -pedantic -Wall test.c




试试gcc -W - Wall -ansi -pedantic -Wwrite-strings -Wfloat-equal


-

查克F(cb********@yahoo.com)(cb ******* *@maineline.net)

可用于咨询/临时嵌入式和系统。

< http://cbfalconer.home.att.net>使用maineline地址!



Try "gcc -W -Wall -ansi -pedantic -Wwrite-strings -Wfloat-equal"

--
Chuck F (cb********@yahoo.com) (cb********@maineline.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE maineline address!




Marc Boyer写道:

Marc Boyer wrote:
你能不能阅读GCC的文档?
要编译c89代码,选项是-std = c89。
今天对c99的支持不通用,因此,在查看
''portability''时,你可以限制自己使用c89 。
当你编译一些gcc发现可疑的代码时,还有其他选项可以警告你。
Can''t you read the documentation of GCC ?
To compile c89 code, the option is -std=c89.
Support of c99 is not universal today, so, when looking at
''portability'', you could restrict yourself to c89.
Other options are there to warn you when you compile some code
that gcc find suspect.




谢谢。但是在gcc手册中总共有8933行。

Debian Linux 3.1。您的专业建议可以从近万行信息中指出

正确选择。


CBFalconer写道:



Thank you. But there are total 8933 lines in gcc manual document in
Debian Linux 3.1. Your expertise suggestion can just point out the
right selection from among nearly ten thousand lines of information.

CBFalconer wrote:

以下选项可以保证不同环境下最便携的C代码吗?
gcc -ansi -pedantic -Wall test.c
Can the following options guarantee the most portable C code for
different environment?
gcc -ansi -pedantic -Wall test.c


试试; gcc -W -Wall -ansi -pedantic -Wwrite-strings -Wfloat-equal"


Try "gcc -W -Wall -ansi -pedantic -Wwrite-strings -Wfloat-equal"




感谢CBFalconer的帮助。


lovecreatesbeauty



Thank CBFalconer for the kind help.

lovecreatesbeauty


这篇关于什么gcc选项保证更多的可移植C代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆