C++ Logo

liaison

Advanced search

[isocpp-wg14/wg21-liaison] Dependent attributes

From: Yeoul Na <yeoul_na_at_[hidden]>
Date: Mon, 04 Aug 2025 11:29:00 -0700
Hi all,

There have been challenges for implementing attributes, such as __counted_by for the bounds safety extension for C, because the language doesn’t allow forward referencing a parameter or a struct field, or referring to a field within the structure.
   
To address this problem, we recently submitted a proposal to WG14 about “dependent attributes” in which forward referencing and unqualified name lookup for struct members in struct is allowed: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3656.pdf

This paper will be discussed in Brno. Our goal is to designing rules that are acceptable both for C and C++, so the attributes can be used in headers shared between these languages. Hope this effort will allow major compilers like Clang and GCC to implement the compatible syntax and semantics in the long run, while still keeping the programming model widely usable.

I was advised to run it by the C/C++ compatibility study group. I’d appreciate your feedback!

Best,
Yeoul

Received on 2025-08-04 18:29:14