I’m using SonarLint 7.8.0.88494 and I get a ““using” should be preferred for type aliasing” cpp:S5416 Tags: cppcoreguidelines design since-c++11
The problem is that the code in question is a typedef for a dynamically loaded Win32 API function and the typedef clearly specifies “stdcall” calling convention (that’s not permitted with the “using” statement). The function is actually the D3DCompile2 function (d3dcompiler.h) - Win32 apps | Microsoft Learn.
The compiler accepted the second form and I now use that for the other statements in my header file. I didn’t know about that syntax and one version of SonarQUbe had offered to fix it but it did not compile (I don’t recall when).
I have decided that because of the issues discussed in the bug report that it probably would be best if I switched back to using typedef’s for those Win32 API functions.
It seems to me that the rule should state that API functions are an exception if they have their own calling conventions.
We actually discussed the topic the other day with some colleagues and reached a similar conclusion. The arguments we considered are available in the ticket and the fix should be available in our next release.
Thanks again for sharing your point of view with us.