|
From: Philipp K. K. <pk...@sp...> - 2025-03-02 08:35:09
|
Am 02.03.25 um 09:07 schrieb Steve Schnepp: > I'm always in favor of having enhanced static analysis. > > That said, I do not know the real cost of the feature. If it enables > other optimizations, perfect. If it impedes other things, I'm more lukewarm. > _Optional does not have a direct impact on optimizations either way. It is mostly a way to tell the compiler "this pointer could be null, please warn me if some code code assumes it to be non-null". However, the infrastructure to give good warnings is mostly the same as the one for generalized constant constant propagation, so some future improvements in generalized constant constant propagation would likely at the same time improve _Optional warnings and optimizations. Adding support for something like N3510, "Enhanced type variance" would also be good for _Optional, so one can more easily combine code written without _Optional in mind with new code using _Optional. However, we'd have to look closely into the details first (what N3510 proposes for "all qualifiers except _Atomic" is likely fine for the const, restrict and volatile qualifiers, but not for named address space qualifiers). Philipp |