News for hackers. Stuff that matters.
Re:Checked C by klodolph on Wednesday December 21, 2022 @04:12PM (#34086459)
That’s because you’d write it as:

  int a[static 3][4]
You only need to put static on the outermost type, the one that decays into a pointer. Same thing applies if you need restrict:

  int a[static restrict 3][4]
which is ugly but gets the job done. Think of int a[3][4], when used as a function parameter, as “pointer to int[4]” (the 3 disappears completely), and think of int a[static 3][4] as “pointer to first of at least 3 int[4]”.

(Not trying to defend C here, just explaining how C works.)

There are no comments on this comment yet.