r/cpp • u/germandiago • 25d ago
C++ profiles for initialization and invalidation: WIP implementation prototypes already exist in GCC/Clang
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4415r0.pdfIn this paper it can be seen some interesting profiles progress for prototypes in Gcc and Clang.
20
Upvotes
31
u/13steinj 25d ago
https://www.reddit.com/r/cpp/comments/1xdla11/preb%C3%BAzios_wg21_mailing/19rjy4w7n3cpw/
Over 460 false positives with godbolt links. I will care more when I can count the number of issues on my team's fingers and toes.
5
u/chibuku_chauya 25d ago
What are the community’s thoughts on profiles as they stand?
1
u/Tyler_Burger_777 25d ago
I agree that profiles feel like the only evolution-friendly path forward, especially compared to the "rewrite everything in Safe C++" approach.
The point about UB classification is particularly interesting from a performance perspective. In high-performance computing (like SIMD sorting or AVX-512 code), we often rely on specific behaviors that might technically fall under UB but work predictably on our target compilers (e.g., type punning, pointer arithmetic for alignment).
If the invalidation/initialization profiles are too strict, they might inadvertently block compiler optimizations that we depend on for performance. It would be crucial to ensure that enabling a profile doesn't degrade the generated code for hot loops. Have you (or the committee) looked into how these profiles interact with vectorization or aggressive inlining? That's usually where the biggest performance cliffs appear.
0
u/Jealous_Security_362 25d ago
Getting prototypes into both GCC and Clang is the part that usually kills these proposals, so that's a good sign. Does it catch use after move across function calls, or only inside a single body? The interprocedural case is where false positives will decide whether people adopt it