[LLVMdev] Minimum Array Size

Tim Northover t.p.northover at gmail.com
Tue Sep 11 04:35:30 PDT 2012


> Is this really the case? In what language(s)? As I understand it, the C99
> standard simply states that a function argument declared as "array of T" is
> equivalent to "pointer to T",

"static" is special though. 6.7.5.3p7 says:

"If the keyword static also appears 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
size expression".

In practice, this mostly just means a compiler can access the
specified number of elements with impunity. In theory you could have a
situation where arrays were allocated differently to normal pointers
and do even less checks (or perhaps look at a cookie before each array
giving its real length...)

Tim.



More information about the llvm-dev mailing list