C++ Logo


Advanced search

Re: [std-proposals] [Draft Proposal] Required attribute syntax

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 07 May 2023 10:10:43 -0700
On Saturday, 6 May 2023 23:07:21 PDT Sebastian Wittmeier via Std-Proposals
> There is [[gnu::fastcall]]
> According to the note in the standard, the unsupporting compilers should
> ignore it.

That's because the attribute makes no difference in behaviour in the abstract
machine that the standard has as its playbox.

But once we do get to ABI and real machines, it does. The real machines and
ABI can determine that the attribute therefore must not be ignored. They could
simply declare that any attribute starting with a given prefix can't be
ignored. They could also somehow arrange that, if it did get ignored, some
later failure would happen -- MSVC still encodes the calling convention in its
mangling, so if you get __fastcall or __syscall or __thiscall or __cdecl
wrong, you get a linker failure.

In the case of fastcall, it's not new: GCC and compatible compilers have
ignored __attribute__((fastcall)) where they weren't known. It's been assumed
that people using these expert features would have expertly decided how to use
them and figured out about compatibility issues. If this hasn't been a problem
for 20 years, why is it now?

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-05-07 17:10:44