Hi Martin,

On Mon, Jan 05, 2026 at 03:42:54PM +0100, Martin Uecker wrote:
> > If you make it a constraint violation, a conforming implementation
> > can reject a program with unknown attributes while now it is required
> > to translate it.

And remember, an implementation is also required to implement

        struct [[alx::packed]] foo {
                char a;
                int64_t b;
                char c;
                int64_t d;
        };

exactly as

        struct foo {
                char a;
                int64_t b;
                char c;
                int64_t d;
        };

(because no implementation recognizes alx:: attributes.)

If this is not an Earthly Demon, tell me what is.

> >  I would also perfer if Clang and GCC would not
> > emit the warning by default, but a warning is still ok as long as the
> > program is translated.
> 
> At the same time, there is nothing useful we would gain from your proposal.

As a starter, we'd reject the code shown above.  That's a useful gain,
isn't it?

But okay, I give up on trying to fix non-scoped attributes.

Since Aaron complained about stdc::attr attributes because they wouldn't
be useful in C++, my third attempt at having useful attributes will be
[[::attr]].  This should be acceptable in C++, because there's no
prefix, and thus nothing that says anything about C.  Does this sound
good to you?


Have a lovely night!
Alex

> If we want to introduce non-ignorable new language features, we can just
> do this using a different syntax, just like we always do.  There is absolutely
> no reason to use attribute syntax for this.    And if this feature isĀ 
> non-ignorable, for example a new jump statement, then as I a reviewer and
> reader of C code I also really want this to look very different from some
> "hint" such as "nodiscard".  I am also sure anybody working on any kind of
> tooling that analysis C code appreciates that the tool can simply
> ignore standard attributes if it wants to and keeps forward compatible to
> any of such future hints we may want to add.  You add a lot of unnecessary
> cost to a lot people of you change this because then any such attribute
> must be treated as potentially affecting semantics.  So please don't.
> 
> Martin
> 
> 
> 
> 

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to