On Fri, Jun 03, 2022 at 04:34:48PM +0000, Miika via Gcc wrote: > Hello, > > I would like to add support for new attribute: nonzero. > Nonzero attribute works the same way as nonnull but instead of checking for > NULL, it checks for integer or enum with value 0.
NULL/nullptr is very special pointer (at it doesn't point to any object), while integer with value 0 is just one of many possible values. For some functions, 0 could be a value it wants to avoid, for others such value could be -1, negative value, positive, whatever else... IMHO if we want to add anything like this, it should be more generic, specify that a particular argument must have value in a specific range. Jakub