xiph/rnnoise

Use std::vector

WindowsNT opened this issue · 5 comments

I'ts better to ensure portability by converting all files to C++ and avoid variable-size arrays.
That way it will also compile with Visual Studio.

I'm sure they mean portability to MSVC.

Replacing variable-length array declarations with dynamic allocations would be a simpler resolution. That still adds portability concerns for some very constrained targets, but it looks like we already have some allocator calls.

@WindowsNT Can you offer a list of the source locations which are failing to compile for you?

Variable size arrays are not standard. std::vector is. I have already converted everything to std::vector, just giving a hint to make this work for windows as well.

I'm not the maintainer, but we're unlikely to convert the project to C++ to work around Visual Studio's incomplete C99 support.

RNNoise is C99. std::vector is not standard C. Also, it performs dynamic allocation, which is bad for real-time processing. The correct solution is to do what Opus does, which is have other fallbacks: either alloca() or offsets into a (non-threadsafe) large global array.