本文介绍了在Visual Studio中是否可以在C99和C11 C标准之间进行切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual Studio Environment的新手,并且正在使用VS2017 Pro.我想用C语言编写简单的程序,并使用c99c11标准进行编译.在Visual Studio中,我只能找到仅用于C ++标准的编译器开关.

I am new to Visual Studio Environment and I am using VS2017 Pro.I wanted to write simple program in C and compiled with both c99 and c11 standards. In Visual Studio, I could only find compiler switches for C++ standards only.

如何告诉Visual Studio环境我们要使用c99c11 C标准编译当前代码.

How can we tell visual studio environment that we want to compile current code with c99 and c11 C standards.

推荐答案

Visual C ++支持的唯一模式"是:/std:c++14模式用于C ++ 14一致性(默认),/std:c++17模式用于C + +17的支持,截至VS 2017(15.6)尚不完全.还有一个/std:c++latest模式,将来会包含C ++ 20中的内容.所有这些都应与/permissive-结合使用,以提高一致性.

The only 'modes' supported by Visual C++ are: /std:c++14 mode for C++14 conformance (the default), /std:c++17 mode for C++17 support which is not quite complete as of VS 2017 (15.6). There is also a /std:c++latest mode which at some future point will include things in C++20. All of these should be combined with /permissive- for improved conformance.

要满足C ++ 11标准库的要求,Visual C ++必须支持C99标准库,这与支持C99语言的要求不一样.

To meet C++11 Standard Library conformance, Visual C++ has to support the C99 Standard Library, that's not the same thing as supporting C99 language conformance.

为了满足C ++ 17标准库的要求,Visual C ++必须支持C11标准库,这又与C11语言一致性不一样.

At some point to meet C++17 Standard Library requirements, Visual C++ will have to support the C11 Standard Library and again that's not the same thing as C11 language conformance.

请参见 C ++标准符合性来自Microsoft C ++ 11/14 STL功能,修复和VS 2013中的重大更改

帖子 MSVC:Windows的最佳选择,其中Visual C ++项目经理负责真正的'C11'一致性问题.

There is a comment thread in the post MSVC: The best choice for Windows where a Visual C++ project manager takes on the question of true 'C11' conformance.

尽管我们首先关注C ++一致性,但C一致性仍在我们的视野中.
我们在VS 2013中做了一些关于C一致性的工作,尽管我们没有公开 很多.该工作包括:
– C99 _Bool
– C99复合文字
– C99指定的初始化程序
– C99变量声明
我们即将结束C ++一致性工作.最后一项 是一个合格的预处理器:C和C ++共享的功能.这 预处理器也将标志着我们的C一致性推动的开始 作为我们C ++ 98/11/14一致性工作的结束.

C conformance is on our radar though we’re focusing on C++ conformance first.
We did some work in VS 2013 on C conformance, though we didn’t publicize it a lot. That work included:
– C99 _Bool
– C99 compound literals
– C99 designated initializers
– C99 variable declarations
We’re nearing the end of our C++ conformance work. One of the last items is a conforming preprocessor: a feature shared by C and C++. The preprocessor will mark the beginning of our C conformance push as well as the end of our C++98/11/14 conformance work.

安德鲁

这篇关于在Visual Studio中是否可以在C99和C11 C标准之间进行切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 08:38
查看更多