I have a bunch of headers in C99 which use the VLA pointer feature to clarify which parameter determines the size of array arguments, like this:
void do_something(int n, float a[n]);
Obviously, when trying to include that in C++ source, this ([n]
) doesn’t parse as extern "C"
because C++ cannot be bothered catching up with a C standard older than our youngest employees.
Is there a convenient way to make that work, i.e. without hand-editing the .h files? Perhaps some tool to translate the declaration to the equivalent (in terms of what’s implemented)
void do_something(int n, float *a);
I’m aware of __counted_by but I’m not ready to migrate the code-base to C23.