Skip to content

static qualifier in array parameter declaration #531

Closed
@monniaux

Description

@monniaux

C99 §6.7.5.3-7 states that static in an array parameter declaration means

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.

Thus the following should be accepted:

int foo5(int t[static 1]) {
  return t[0];
}

int foo6(int t[const static 1]) {
  return t[0];
}

I suspect the simplest is to ignore this keyword. (Technically, one could use it to convey semantic information that the area pointed to should be accessible for a certain length, thus allowing some optimizations such as speculatively loading values, but this would require quite a bit of work…)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions