C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries

From: Harald Achitz <harald_at_[hidden]>
Date: Tue, 14 Oct 2025 20:08:44 +0200
On 2025-10-14 17:06, René Ferdinand Rivera Morell via SG15 wrote:
>
>
> On Tue, Oct 14, 2025 at 9:50 AM Gabriel Dos Reis <gdr_at_[hidden]>
> wrote:
>
> There are two assertions there that I cannot understand. Rene,
> could you explain further the impossibility?
>
>
> It's simple.. If you use a macro in your headers users can override
> any control you may think you have over that macro.
>
> --
> -- René Ferdinand Rivera Morell
> -- Don't Assume Anything -- No Supongas Nada
> -- Robot Dreams - http://robot-dreams.net
>
>
> _______________________________________________
> SG15 mailing list
> SG15_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg15

Can they ? What about
https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html
and
https://clang.llvm.org/docs/DiagnosticsReference.html#wbuiltin-macro-redefined

not that I want to defend macros, but I wonder if that argument brought
up is very valid (anymore)
and yes, they are 'just' warning, but if you ignore warnings and don't
thread them as errors, contracts might also give you nothing

I have the feeling if I control the CI, there is not too much danger in
redefining or undefining macros, but I havn't made the bad actor test,
so there might be something I miss

/Harald

Received on 2025-10-14 18:08:51