Use std::vector in the CacheLocalityBenchmark rather than a VLA
authorChristopher Dykes <cdykes@fb.com>
Fri, 1 Jul 2016 01:19:14 +0000 (18:19 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Fri, 1 Jul 2016 01:24:14 +0000 (18:24 -0700)
Summary: Because MSVC doesn't support VLAs.

Reviewed By: yfeldblum

Differential Revision: D3506835

fbshipit-source-id: 8683b5c513ed25e7f47642c8493f8b10da9906be

folly/test/CacheLocalityBenchmark.cpp

index 81f094d95111e78dfff894acbd323b611c9ff6ba..cc570391c14b69bf2cc89ccb0a8843192564a567 100644 (file)
@@ -160,7 +160,7 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work) {
   std::vector<std::thread> threads;
   while (threads.size() < numThreads) {
     threads.push_back(std::thread([&, iters, stripes, work]() {
-      std::atomic<size_t>* counters[stripes];
+      auto counters = std::vector<std::atomic<size_t>*>(stripes);
       for (size_t i = 0; i < stripes; ++i) {
         counters[i] =
             new (raw.data() + counterAlignment * i) std::atomic<size_t>();