songgaoye commented on code in PR #3616:
URL: https://github.com/apache/brpc/pull/3616#discussion_r4302120990
##########
src/bvar/detail/percentile.h:
##########
@@ -129,7 +130,13 @@ class PercentileInterval {
const size_t num_remain_from_rhs = SAMPLE_SIZE - num_remain;
CHECK_LE(num_remain_from_rhs, rhs._num_samples);
// Have to copy data from rhs to shuffle since it's const
- DEFINE_SMALL_ARRAY(uint32_t, tmp, rhs._num_samples, 64);
+ uint32_t tmp_stack[64];
+ std::unique_ptr<uint32_t[]> tmp_heap;
+ uint32_t* tmp = tmp_stack;
+ if (rhs._num_samples > ARRAY_SIZE(tmp_stack)) {
+ tmp_heap.reset(new uint32_t[rhs._num_samples]);
+ tmp = tmp_heap.get();
+ }
Review Comment:
reslove this error `In file included from ../../src/bvar/bvar.h:27:
In file included from ../../src/bvar/latency_recorder.h:26:
../../src/bvar/detail/percentile.h:132:13: warning: variable length arrays
in C++ are a Clang extension [-Wvla-cxx-extension]
132 | DEFINE_SMALL_ARRAY(uint32_t, tmp, rhs._num_samples, 64);`
It's in
https://github.com/apache/brpc/actions/runs/38880333262/job/116905256122
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]