MinGW的编译器Windows,使用GCC,C99 VS GNU99 [英] MinGW Compiler for Windows, using GCC, C99 vs GNU99

查看:912
本文介绍了MinGW的编译器Windows,使用GCC,C99 VS GNU99的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MinGW的编译器的Windows。我在做我C.在这读了文章的大多数某些程序似乎已经过时......最后我读C99在海湾合作委员会是不完整的,这仍然是真的吗?我真正的问题是设置C99和GNU99 ...之间的跨平台兼容性,我应该避免使用GNU99设置,它的扩展,只是坚持与C99?我是新来这个MinGW的编译器设置为我一直使用Visual Studio和决定尝试新的东西......现在我使用这些设置编译...

I am using the MinGW compiler for Windows. I am making some programs in C. Most of the articles I read up on this seem to be outdated... last I read C99 was incomplete in the GCC is this still true? My real question is cross platform compatibility between setting C99 and GNU99... should I avoid using GNU99 setting and it's extensions and just stick with C99? I am new to this MinGW compiler set as I have always used Visual Studio and decided to try something new... right now I am compiling with these settings...

-march=native -O3 -std=gnu99

有没有推荐的编译器的命令,我应该作出C程序输入,也用于制作C ++程序使用该编译器?

Is there any recommended compiler commands I should enter for making C programs and also for making C++ programs with this compiler?

我想作一个简单的程序,它是与Windows,Mac,和放大器兼容; Linux,但第一大多数的Windows。

I want to make a simple program that is compatible with Windows, Mac, & Linux but first most Windows.

推荐答案

对于C,的Visual Studio 直到最近根本没有支持 C99。

With respect to C, Visual Studio until recently did not support C99 at all.

对于 GCC 你可以找到详细的详细的书面记录上的标准,他们的支持和角落和缝隙参与。他们也有一个很好的列表他们支持。你需要用 GCC 和扩展小心一点,因为只是指定要使用的标准是不够的,生成一个警告或错误时,你正在使用的扩展。例如,你可能会惊讶,使用:

With respect to gcc you can find a detailed detailed writeup on which standard they support and the nooks and crannies involved. They also have a nice list of extensions they support. You need to be a little careful with gcc and extensions because just specifying which standard you want to use is not enough to generate a warning or error when you are using an extension. For example you might be surprised that using:

gcc -std=c90 -W -Wall

允许你使用<一个href=\"http://stackoverflow.com/questions/16588265/why-am-i-being-allowed-to-use-a-const-qualified-variable-as-an-array-size-in-c\">variable长数组的而不发出警告。为了产生需要添加一个警告 -pedantic

allows you to use variable length arrays without a warning. In order to generate a warning you need to add -pedantic:

gcc -std=c90 -W -Wall -pedantic

和那么这将产生一个警告类似于此:

and then this will generate a warning similar to this:

warning: ISO C90 forbids variable length array ‘array’ [-Wvla]

这篇关于MinGW的编译器Windows,使用GCC,C99 VS GNU99的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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