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/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 null pointer checks, e.g.:

void f(_Optional char *p)
{
    *p = 0; // Warning here
}

void g(_Optional char *p)
{
    if(p)
        *p = 0; // No warning here
}

Since _Optional is essentially an opt-in mechanism, we would not get any
false warnings on existing code.

Philipp



_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to