You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In view of my lack of knowledge on features of different compiler versions.
I submit my source code (max1.cc as follows) on https://cppinsights.io/
#include<cstdio>template<typename T1, typename T2>
automax(T1 a, T2 b) {
return b < a ? a : b;
}
intmain() {
int a = 1;
float b = 2.2;
auto x = max<int, float>(a, b);
}
and the transformed Insignt shows:
#include<cstdio>template<typename T1, typename T2>
automax(T1 a, T2 b) {
return b < a ? a : b;
}
#ifdef INSIGHTS_USE_TEMPLATE
template<>
float max<int, float>(int a, float b)
{
return b < static_cast<float>(a) ? static_cast<float>(a) : b;
}
#endifintmain()
{
int a = 1;
float b = static_cast<float>(2.2000000000000002);
float x = max<int, float>(a, b);
}
But I wonder whether this transformation is identical with the one that my local compiler does.
As mentioned in the compatibility part of README.md, the most recent stable version of clang is supported.
So, will the transformaton process influenced by the version of clang?
PS. My clang version on macos
$ /usr/bin/clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
The text was updated successfully, but these errors were encountered:
declmal
changed the title
Is the tranformed code identical with my local actual
Is the tranformed code in cppinsights.io identical with the one transformed by my local compiler
Nov 14, 2021
declmal
changed the title
Is the tranformed code in cppinsights.io identical with the one transformed by my local compiler
Is the tranformed code in https://cppinsights.io identical with the one transformed by my local compiler
Nov 14, 2021
declmal
changed the title
Is the tranformed code in https://cppinsights.io identical with the one transformed by my local compiler
Is the tranformed code in https://cppinsights.io identical with the one transformed by my local compiler clang-1200.0.32.29Nov 14, 2021
well that is a very good question. The result depends on various factors. The Clang version is one, the operating system the other, and the standard library.
The webserver runs on Linux. C++ Insights there uses libstdc++ (GCC's STL) as a default. The code that you show here, I assume, is identical. To be sure, you have to run C++ Insights locally with the exact same version of Clang.
Is there any particular reason why you want to be sure?
Hello @andreasfertig
Thanks for your answer.
I am currently building c++ projects with template programming.
If both results are identical or almost the same, I could use insignts to debug my project (with tedious compilation erros...), since the transformed code would be informative.
In view of my lack of knowledge on features of different compiler versions.
I submit my source code (
max1.cc
as follows) onhttps://cppinsights.io/
and the transformed
Insignt
shows:But I wonder whether this transformation is identical with the one that my local compiler does.
As mentioned in the
compatibility
part ofREADME.md
, the most recent stable version of clang is supported.So, will the
transformaton
process influenced by the version of clang?PS. My
clang
version on macosPSS. My
CMakeLists.txt
The text was updated successfully, but these errors were encountered: