Name
	n4015, alx-0080r2 - [static] without array length expression

Principles
	-  Keep the language small and simple

Category
	Language; array parameters.

Author
	Alejandro Colomar <alx@kernel.org>

	Cc: Martin Uecker <uecker@tugraz.at>
	Acked-by: Doug McIlroy
	Acked-by: Andrew Clayton <ac@sigsegv.uk>

History
	<https://www.alejandro-colomar.es/src/alx/alx/std/wg14/alx-0080.git/>

	r0 (2026-01-25):
	-  Initial draft.

	r1 (2026-01-26):
	-  Acked-by.
	-  tfix

	r2 (2026-10-25; n4015):
	-  Do not depend on alx-0079.
	-  Rebase on latest draft.
	-  Update abstract declarators too.
	-  Update (simplify) 6.7.7.3.

Abstract
	'static' in [static n] means that the argument shall be
	non-null.  That is entirely independent of the length of the
	array parameter, so it doesn't make sense requiring the length
	to be specified.  Lift that restriction.

Discussion
	While the standard, for a long time, claimed that 'static' in
	[static n] was about the length of the array, it is well known
	that this is only true in paper.  In practice, programmers use
	[n] with that meaning.

	'static' in [static n] has a different meaning (see also
	alx-0079): it says that the argument shall be non-null.

	Let's allow programmers to use that meaning without having to
	use a dummy 1 (which is actually bad for safety).

Comments
	On 2026-01-25T18:19:02-0500, Douglas McIlroy wrote:
	> All six proposals look eminently reasonable.  They simplify
	> the language and remove surprises.  I suspect these proposals
	> will invalidate very few existing programs.  In any event, the
	> required corrections will improve the legibility and
	> maintainability of such programs.
	>
	> Doug McIlroy

	---

	On 2026-01-26T02:01:16+0000, Alex Celeste wrote:
	> Like Martin - these all seem eminently reasonable to me.

Proposed wording
	Based on N3886.
	
    6.7.7.1  Declarators :: General
	@@ Syntax, p1
	+array-qualifier-list:
	+	<b>static</b>(opt) type-qualifier-list
	+	type-qualifier-list <b>static</b>
	+
	+array-length-declarator:
	+	assignment-expression
	+	<b>*</b>
	+
	 array-declarator:
	-	direct-declarator <b>[</b> type-qualifier-list(opt) assignment-expression(opt) <b>]</b>
	-	direct-declarator <b>[ static</b> type-qualifier-list(opt) assignment-expression <b>]</b>
	-	direct-declarator <b>[</b> type-qualifier-list <b>static</b> assignment-expression <b>]</b>
	-	direct-declarator <b>[</b> type-qualifier-list(opt) <b>* ]</b>
	+	direct-declarator <b>[</b> array-qualifier-list(opt) array-length-declarator(opt) <b>]</b>
	
    6.7.7.3  Array declarators
	@@ Semantics, p3
	 If, in the declaration "T D1",
	-D1 has one of the forms:
	+D1 has the form:
	-	D <b>[</b> type-qualifier-list(opt) assignment-expression(opt) <b>]</b> attribute-specifier-sequence(opt)
	-	D <b>[ static</b> type-qualifier-list(opt) assignment-expression <b>]</b> attribute-specifier-sequence(opt)
	-	D <b>[</b> type-qualifier-list <b>static</b> assignment-expression <b>]</b> attribute-specifier-sequence(opt)
	-	D <b>[</b> type-qualifier-list(opt) <b>* ]</b> attribute-specifier-sequence(opt)
	+	D <b>[</b> array-qualifier-list(opt) array-length-declarator(opt) <b>]</b> attribute-specifier-sequence(opt)
	...
	
    6.7.7.4  Function declarators
	 A declaration of a parameter as "array of type"
	 shall be adjusted to "qualified pointer to type",
	 where the type qualifiers (if any)
	 are those specified
	 within the [ and ] of the array type derivation.
	+If the keyword <b>static</b> appears
	+within the [ and ] of the array type derivation,
	+then the pointer must be valid.
	-If the keyword <b>static</b> also appears
	+If both the keyword <b>static</b>
	+and an array length expression
	+appear
	 within the [ and ] of the array type derivation,
	 then for each call to the function,
	 the value of the corresponding actual argument
	 shall provide access to the first element of an array
	 with at least as many elements as specified
	 by the array length expression.
	
	## That 'also' seemed incorrect.
	
    6.7.8  Type names
	@@ Syntax, p1
	 array-abstract-declarator:
	-	direct-abstract-declarator <b>[</b> type-qualifier-list(opt) assignment-expression(opt) <b>]</b>
	-	direct-abstract-declarator <b>[ static</b> type-qualifier-list(opt) assignment-expression <b>]</b>
	-	direct-abstract-declarator <b>[</b> type-qualifier-list <b>static</b> assignment-expression <b>]</b>
	-	direct-abstract-declarator <b>[</b> type-qualifier-list(opt) <b>* ]</b>
	+	direct-abstract-declarator <b>[</b> array-qualifier-list(opt) array-length-declarator(opt) <b>]</b>