I recently started studying at university which granted me a student license for all JetBrains products. I thought it would be an excellent chance to try Resharper for C# and C++. I am now taking a course in C.
From what I searched online, Visual Studio can work with C code. However, it seems that Resharper is only meant for C++ as it suggests warnings that only make sense in C++. For example, if I use something like #define N 5
, Resharper suggests I use constexpr
instead, which doesn’t exist in C as far as I am aware.
Also, there are no options for Code Editing menu for C in Resharper’s settings window, only for C++. This means I can’t configure separate naming conventions for C and C++ for example. For example, I like the convention of ALL_CAPS
for enum constants in C, since they live in the global namespace. In C++, however, I can use enum class
so enum constants live in the enum’s namespace and I can be more flexible and use PascalCase
for instance.
Is there a way to configure Resharper to work with C? Or at least configure it not to display inspections specific for C++ in C files?
2
Answers
Turns out this is a Visual Studio inspection and not a ReSharper one. Disabling Visual Studio IntelliSense via
Options | Text Editor | C/C++ | Advanced | Browsing/Navigation | Disable Database
solves the issue.ReSharper supports the C language. When a file uses C, C++-specific code checks should get disabled in that file. If you see C++-specific suggestions in a C file, file an issue or let JetBrains know via "ReSharper | Help | Report a bug".
It does not make a lot of sense to add separate settings for the C language since they are mostly the same as for C++. Regarding naming conventions, you can configure separate rules for members of
enum
andenum class
if you want to. You can also create custom naming conventions for your C project and save them to project settings.