In VS2019, SonarLint underlines the addition of sizeof with error C6305, but same code in Visual Studio Code results without any errors.
Is this a configuration issue?
It might be a configuration problem. First, try to check if you have all set for C/C++ analysis.
If everything is good there - please provide the SonarLint output that comes when you open C/C++ files.
Executing /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/jre/17.0.7-linux-x86_64.tar/bin/java -jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/server/sonarlint-ls.jar -stdio -analyzers /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonargo.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarjava.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarjs.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarphp.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarpython.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarhtml.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarxml.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonarcfamily.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonartext.jar /root/.vscode-server/extensions/sonarsource.sonarlint-vscode-3.19.2-linux-x64/analyzers/sonariac.jar
[Warn - 12:01:37.296] Using ${workspaceFolder} variable in sonarlint.pathToCompileCommands is only supported for files in the workspace
[Info - 12:01:37.421] Analyzing file 'path/filename.cpp'...
[Info - 12:01:43.650] Found 4 issues
[Info - 12:01:43.675] Analyzing file 'path/.vscode/c_cpp_properties.json'...
[Info - 12:01:43.824] Found 0 issues
[Warn - 12:09:26.617] Using ${workspaceFolder} variable in sonarlint.pathToCompileCommands is only supported for files in the workspace
[Debug - 12:09:28.565] Fetching global configuration
[Warn - 12:09:28.567] Using ${workspaceFolder} variable in sonarlint.pathToCompileCommands is only supported for files in the workspace
[Debug - 12:09:28.567] Fetching configuration for folder 'path'
[Debug - 12:09:28.569] Global settings updated: WorkspaceSettings[connections={},disableTelemetry=false,excludedRules=[],includedRules=[],pathToNodeExecutable=,ruleParameters={},showAnalyzerLogs=true,showVerboseLogs=true]
C6305 Warning C6305 | Microsoft Learn is a VisualStudio compiler warning and not an issue raised by SonarLint. They usually start with capital C. something like Cxxxx.
SonarLint issues for C&C++ look like c:Sxxxx and cpp:Sxxxx. The language + : + S + number. When you click on them in Visual Studio, they should show the Sonar Rules description.
while something like C6305 will direct you to the Microsoft website.
That is why you don’t see C6305 in VS Code; it is simply not raised by SonarLint.