> >> The macro name seems pretty long, given how commonly used this would
> >> be for code that uses Gustedt's style. How about a shorter name like
> >> "ATIC", short for "Array TINIEST INDEX COUNT"? This macro name is
> >> short and (unlike "STATIC") is unlikely to be used in existing code.
> >
> > I'm not sure... Unfortunately this is unlike
> > AC_C_{REGISTER,VOLATILE,INLINE} because it's only in this context that
> > static isn't supported. Maybe VLA_STATIC? FWIW a lookup on GitHub did
> > not return exact matches.
>
> "VLA_STATIC" is still too long. Also, the name is confusing, because
> it's a macro for declaring pointer objects that have automatic (not
> static) storage duration. (This is a beef I have with the keyword
> "static" in the first place, of course.)
I agree there's possible confusion, but VLA_STATIC reads less
confusing than STATIC_VLA, for instance. Of course if STATIC makes the
user think of storage duration, that's a problem. If the array size is
a constant integer expression, I don't think that the array is a VLA
or a variably modified type. So even using VLA could be wrong...
> Admittedly "ATIC", while short, is not a great name either. How about
> "ATLEAST" instead? Although it's longer, it's more self-explanatory.
> Code would look like this:
>
> int strcmp (char const a[ATLEAST 1], char const b[ATLEAST 1]);
>
> and this is more self-explanatory than "static" is.
I like ATLEAST.
> > Note that the semantics changed between C17 (6.10.8.3):
> Yes, I suppose ATLEAST can mean "static" for C11 and later, the empty
> string earlier (roughly speaking, depending on what compilers actually
> support).
I meant that the semantics of __STDC_NO_VLA__ changed! The static
keyword for array types is a C99 feature that has never changed.
> An issue related to ATLEAST, though, is that in the GNU world people
> typically use the nonnull attribute instead, e.g.:
>
> int strcmp (char const *, char const *)
> __attribute__ ((__nonnull__ (1,2)));
>
> An advantage of this approach is that it's more flexible and powerful,
> for example:
>
> void *memcpy (void *, void const *, size_t)
> __attribute__ ((__nonnull_if_nonzero__ (1, 3),
> __nonnull_if_nonzero__ (2, 3)));
>
> which is something that the "static" syntax cannot say.
Thanks, I didn't know this attribute. "static" works if sizes of the
arrays are constant expressions, otherwise it's just a nonnull
annotation.
https://godbolt.org/z/nK38Knr6a