Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

visual studio - Which version of C is supported by VS2019 compiler?

How can I know which version of C is supported by the VS2019 compiler? I looked in the project C/C++ and Linker command lines and found no -std=Cxx flag. The following code compiles:

for (int i = index; i < nb_users - 1; i++) {
    users[i] = users[i + 1];
}

So I guess it's C99 according to this, but is there a way to check this somewhere in VS2019?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

VS2019 supports ANSI C90 plus a few other features from a few later standards that are required in C++.

For example, you can tell that C99 is not fully supported in MSVC with this code, which will fail to compile:

int foo(int n, char *s)
{
    char s2[n];
    strcpy(s2, s);
    return !strcmp(s, s2);
}

This specific feature (variable-length arrays) is not supported in MSVC, while the feature you mentioned (for loop initial declaration) is.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...