Date: Sun, 31 Aug 2025 15:33:47 +0300
On 31 Aug 2025 14:40, Tiago Freire via Std-Discussion wrote:
>
> Why can't I just open an exception in my code test for the system you
> will be deploying and take advantage of it? And why shouldn't this be
> made easier?
> What standard, other than THE C++ standard, should define this
> identification?
A standard that is specific to your target system? That "standard" may
be simply your compiler documentation.
The C++ standard doesn't exist in a vacuum, and it doesn't have to be
the only standard you interact with. In fact, it almost never is. It is
almost impossible to write any remotely complex and useful program
relying exclusively on pure C++. At some point, you will have to
interact with POSIX/Windows APIs or external libraries or specialized
hardware, including SIMD units in your CPU, your GPU, and each and every
time you will be dealing with different "standards", with various
definitions of the term. Putting everything into the C++ standard just
isn't feasible, and neither it is desirable. What is desirable is making
different "standards" work together well.
Now, to the topic of specifically identifying available ISA extensions,
I agree that it would be useful if those could be indicated in a more
unified way across compilers and targets. We almost have that for x86
with the gcc/clang macros convention, which MSVC tries to pick up. It
would be useful to have a common specification that all compiler vendors
have agreed on and implemented. But that specification does not have to
be and should not be the C++ standard, as it is out of scope.
>
> Why can't I just open an exception in my code test for the system you
> will be deploying and take advantage of it? And why shouldn't this be
> made easier?
> What standard, other than THE C++ standard, should define this
> identification?
A standard that is specific to your target system? That "standard" may
be simply your compiler documentation.
The C++ standard doesn't exist in a vacuum, and it doesn't have to be
the only standard you interact with. In fact, it almost never is. It is
almost impossible to write any remotely complex and useful program
relying exclusively on pure C++. At some point, you will have to
interact with POSIX/Windows APIs or external libraries or specialized
hardware, including SIMD units in your CPU, your GPU, and each and every
time you will be dealing with different "standards", with various
definitions of the term. Putting everything into the C++ standard just
isn't feasible, and neither it is desirable. What is desirable is making
different "standards" work together well.
Now, to the topic of specifically identifying available ISA extensions,
I agree that it would be useful if those could be indicated in a more
unified way across compilers and targets. We almost have that for x86
with the gcc/clang macros convention, which MSVC tries to pick up. It
would be useful to have a common specification that all compiler vendors
have agreed on and implemented. But that specification does not have to
be and should not be the C++ standard, as it is out of scope.
Received on 2025-08-31 12:33:50