Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static qualifier in array parameter declaration #531

Open
monniaux opened this issue Oct 29, 2024 · 0 comments
Open

static qualifier in array parameter declaration #531

monniaux opened this issue Oct 29, 2024 · 0 comments

Comments

@monniaux
Copy link
Contributor

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…)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant