[RFC] Support for nonzero attribute (Miika)

Yair Lenga yair.lenga@gmail.com
Wed Jun 8 15:02:31 GMT 2022


Miika - lot of thanks. In .y mind, this is a major improvement.

Also, want to suggest taking a nother look into the semnatic. I agreed
inrange should include the low and high, similar to the gcc extensions) ..
operator, the SQL in operator, perl .. operator, etc.

There is another use common use case: creating a variable that can be used
to index an array. With the inrange:

Double a[MAX_ELEM];

Int ia __attr__((inrange(0, (sizeof(a)/sizeof(a[0]))) ;

One trivial solution will be to define a macro
#define array_index(a) int __attr__((inrange(0, (sizeof(a)/sizeof(a[0])))

And then we can do:
Array_index(a) ia;

which I think is very cool.

Yair


More information about the Gcc mailing list