Tomasz Kaminski [Monday, 20 October 2025, 15:43:50 CEST]: > On Mon, Oct 20, 2025 at 3:32 PM Matthias Kretz <[email protected]> wrote: > > Let me start with your last point: > > > > Tomasz Kaminski [Monday, 20 October 2025, 11:24:55 CEST]: > > > I think I would prefer the direction of just using plain > > > __glibcxx_assert > > > for libstdc++, and not innovate a new error checking > > > strategies. > > > > Yes. I guess the simd PR should just use __glibcxx_assert and I should > > open a > > separate PR that would innovate new precondition checking consistently all > > over libstdc++. That said, I don't want to miss these error messages in my > > simd code. They have been helpful. > > We have hardened preconditions in c++26, that will turn some of the checks > into contract violations. I am a bit afraid of tying our hands there, and > would > prefer to not deviate until we see what will happen with that.
Sure. Contracts will certainly change the picture. And if we have a contracts implementation that warns on unconditional precondition violation in constant propagation then we don't need to do any of what I said in the library. I guess, that's part of the point I'm trying to make, though. That this is a feature we want to have. Once we have contracts, that's where it belongs. IIUC, hardened preconditions can be described as https://compiler-explorer.com/z/8sjf3x9rT. So as I see it there could be 3 macros (as long as we don't have contracts in the language) __glibcxx_assert(expr) __glibcxx_precondition(expr) __glibcxx_hardened_precondition(expr) - Matthias -- ────────────────────────────────────────────────────────────────────────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Research https://gsi.de std::simd ──────────────────────────────────────────────────────────────────────────
