When compiling the following code with msvc2017
void Foo::bar(A */*a*/)
I get this warning:
foo.cpp:38: warning: C4138: '*/' found outside of comment
I can fix this by adding a space after the asterisk:
void Foo::bar(A * /*a*/)
however, I would have to do this in a bunch of places, and if I ever uncomment the parameter, the coding style I use won't be followed due to the extra space.
Since I don't get the same warning with gcc or clang, I'm wondering if this is a MSVC-specific quirk that can safely be disabled.
Yes this is a unwarranted warning; there is nothing wrong with the code you present. In fact, commenting out variable names in function definitions can be useful for example when you want to suppress "unused variable" warnings in function parameters lists that are self-documenting.
Switch off the warning and rely on the compiler to issue a diagnostic if indeed there is a mismatched comment block in your code.
Submit a bug report to the compiler vendor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With