int function(const char *p)
{
const int str_size = strlen(p);
char parameter[str_size];
...
}
The above code compiled using Microsoft Visual Studio 2019 C compiler gives errors:
Error E0028 expression must have a constant value
Error C2057 expected constant expression
Error C2466 cannot allocate an array of constant size 0
Error C2133 'parameter': unknown size
I have compiled the same code using GCC and Clang successfully.
Is there a way to relax Microsoft C compiler permissiveness? I tried /permissive
but it didn't help. Any other solution?
p.s.
Why do I need to use Microsoft compiler? Becuase I need to build a Windows Audio Processing Object (APO), and the above code is part of the static library that needs to be linked with the APO.