I heard that in Visual Studio you can program in C, creating a C ++ project and renaming the file with the code in the * .c format. Tell me, does the compiler fully support C or are there any annoying limitations? For example, I noticed that programs with printf, scanf, gets ... are not compiled ... The compiler requires the use of safe functions with the _s postfix (gets_s example).

    1 answer 1

    Visual Studio does not fully support the C99 standard, although much is supported. printf , scanf are supported, you just get warnings that they are not safe. Therefore, strictly speaking, it is impossible to write fully (that is, using all available features) in C using Visual Studio. But for many tasks, VS will be enough. If I'm not mistaken, ffmpeg compiled by MSVC2013, and that says a lot.

    A small quote from the coat of arms of Sutter:

    If you really need <COST / C99 / C11 <...> C ++ / C11 / C11 <...> then we recommend using a different compiler such as Intel or gcc

    Update : Several alternative IDEs for Windows from comments:

    You can also try using clang in Visual Studio , but I'm not sure that this project has grown to release quality.

    Update 2: Because My statement about the inadequate support of the development studio in the C language caused a dispute, here is one feature from C99 that the studio does not support: VLA . This, of course, is not the only difference, but one of the most pronounced. There is a list here , but it does not take into account that the C99 part migrated to C ++ 11. I have not found such a list for the present, but there are differences and they can become a stumbling block in the process of development. Although I repeat, ffmpeg studio (according to MS) is going, and this suggests that much is still supported. But you should not count on full support, and if you want to use C with all the functionality, you should pass by the MSVC ++ compiler - this is a compiler for C ++, not C.

    • Are there any convenient analogs of the Visual Studio type, besides Rad Studio? Are there any extensions for Visual Studio? - iluxa1810
    • There is a CLion , I did not use it, but JetBrains inspires confidence - ixSci
    • one
      "And some convenient analogs" - under XP I use either a free studio with #define _CRT_SECURE_NO_WARNINGS for all project files, or Eclipse in conjunction with MinGW. The latter option has no problems with C at all. - user6550
    • @klopp, _CRT_SECURE_NO_WARNINGS - you can add to the project settings, then you do not need to add to each file - ixSci
    • Another QtCreator can be used, although I am not thrilled with it (on the other hand, I have not used it for more than a year, maybe it has changed) - ixSci