Re: [Sdcc-user] _Optional

2025-03-05 Thread Philipp Klaus Krause
Am 05.03.25 um 13:26 schrieb Maarten Brock: Is there also a counterpart like _Required or _NonNull to indicate that the pointer must already be checked to be non-null? It would have to be used in the prototype of course. It could climb up the calling tree to a point where the check is performed o

Re: [Sdcc-user] _Optional

2025-03-05 Thread Maarten Brock
Philipp Klaus Krause schreef op 2025-02-26 11:22: Dear SDCC users, would an _Optional qualifier (see N3422 - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3422.pdf for details) be useful to you? Basically, it would be a way for programmers to explicitly specify that a pointer might be null.

Re: [Sdcc-user] _Optional

2025-03-02 Thread Steve Schnepp
On Sun, Mar 2, 2025 at 9:35 AM Philipp Klaus Krause wrote: > However, the infrastructure to give good warnings is mostly the same as > the one for generalized constant constant propagation, so some future That sounds promising indeed, as the added effort looks quite low compared to its benefits

Re: [Sdcc-user] _Optional

2025-03-02 Thread Philipp Klaus Krause
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 opti

Re: [Sdcc-user] _Optional

2025-03-02 Thread 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. Cheers, -- Steve SCHNEPP On Wed, Feb 26, 2025, 14:57 Philipp Klaus Krause wrote: > Am 26.0

Re: [Sdcc-user] _Optional

2025-03-01 Thread Chris Bazley
Thank you, Philipp. In case it is useful, the Compiler Explorer website allows users to experiment with this feature: https://godbolt.org/z/jffvhnoG5 This will be misnamed as a C++ compiler in your browsers (something that I am trying to resolve with the site’s maintainers) but it is actually

Re: [Sdcc-user] _Optional

2025-02-26 Thread Philipp Klaus Krause
Am 26.02.25 um 13:17 schrieb Chris Bazley: Thank you, Philipp. In case it is useful, the Compiler Explorer website allows users to experiment with this feature: https://godbolt.org/z/jffvhnoG5 This will be misnamed as a C++ compiler in your browsers (somethin

Re: [Sdcc-user] _Optional

2025-02-26 Thread Philipp Klaus Krause
Am 26.02.25 um 14:06 schrieb Sebastien Lorquet: Hello, How would that compare to __attribute__((weak)) ? https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/Function-Attributes.html Sebastien They are unrelated. __attribute__((weak)) is for the linker, _Optional for the compiler. ___

Re: [Sdcc-user] _Optional

2025-02-26 Thread Sebastien Lorquet
Hello, How would that compare to __attribute__((weak)) ? https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/Function-Attributes.html Sebastien On 26/02/2025 11:22, Philipp Klaus Krause wrote: Dear SDCC users, would an _Optional qualifier (see N3422 - https://www.open-std.org/jtc1/sc22/wg14/www/do

[Sdcc-user] _Optional

2025-02-26 Thread Philipp Klaus Krause
Dear SDCC users, would an _Optional qualifier (see N3422 - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3422.pdf for details) be useful to you? Basically, it would be a way for programmers to explicitly specify that a pointer might be null. This would allow the compiler to warn on missing