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

Use C99 static array size specifier in C function prototypes #139

briansmith opened this issue Mar 7, 2016 · 0 comments


None yet
1 participant
Copy link

commented Mar 7, 2016


Quoting a comment on that page: "this feature is described in bullet 7, ISO/IEC 9899:201x n1570 working draft."

Instead of writing void foo(int myArray[10]); we should write void foo(int myArray[static 10]); But, this doesn't work in all compilers so we probably need some macro like this:

#if <compiler is known to support it>
#define FIXED_SIZE_ARRAY_PARAM(x, len) x[static len]
#define FIXED_SIZE_ARRAY_PARAM(x, len) x[len]

and then do something like void foo(int FIXED_SIZE_ARRAY_PARAM(myArray, 10));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.