public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] Support for nonzero attribute (Miika)
@ 2022-06-08 15:02 Yair Lenga
  0 siblings, 0 replies; only message in thread
From: Yair Lenga @ 2022-06-08 15:02 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 15:02 [RFC] Support for nonzero attribute (Miika) Yair Lenga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).