bastibl / gr-foo

Some GNU Radio blocks that I use.
GNU General Public License v3.0
106 stars 56 forks source link

Fix use of VLA #28

Closed gvanem closed 3 years ago

gvanem commented 3 years ago

In my effort to build gr-ieee802-11 with MSVC-2019, I gathered I need this OOT block too.

It builds fine with clang-cl on Windows, but stops with MSVC not supporting VLA (Variable Length Arrays). Error was:

random_periodic_msg_source_impl.cc(96): error C2131: expression did not evaluate to a constant
random_periodic_msg_source_impl.cc(96): note: failure was caused by a read of a variable outside its lifetime
random_periodic_msg_source_impl.cc(96): note: see usage of 'this'
random_periodic_msg_source_impl.cc(99): error C3863: array type 'uint8_t [this->8]' is not assignable

Simply switching to std::vector , it compiles using MSVC-2019 too.

With my limited C++ knowledge, I hope and believe it's almost the same (but a bit slower). Or maybe using alloca() would be better?

bastibl commented 3 years ago

Thank you. I don't have the chance to test it on Windows. I cherry-picked it on maint-3.8 and merged it into maint-3.9.