Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()

From
Al Viro <viro@ZenIV.linux.org.uk>
Date
2018-03-16 20:12:15
Also in
linux-input, lkml
Reply to
Linus Torvalds, 2018-03-16
On Fri, Mar 16, 2018 at 12:27:23PM -0700, Linus Torvalds wrote:
But it sure isn't "variable" either as far as the standard is
concerned, because the standard doesn't even have that concept (it
uses "variable" for argument numbers and for variables).
Huh?  6.7.5.2p4:

If the size is not present, the array type is an incomplete type.
If the size is * instead of being an expression, the array type is
a variable length array type of unspecified size, which can only be
used in declarations with function prototype scope [footnote]; such
arrays are nonetheless complete types.  If the size is an integer
constant expression and the element type has a known constant size,
the array type is not a variable length array type; otherwise, the
array type is a variable length array type.

footnote: Thus, * can be used only in function declarations that are
not definitions (see 6.7.5.3).

That's C99, straight from N1256.pdf (C99-TC3)...
Thread (37 messages) 37 messages, 10 authors, last reply 2018-03-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help