Commit 1ccc20a4 authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-4

Use alloca rather than C99 stack allocated arrays

Summary: Because MSVC doesn't support the latter.
Closes https://github.com/facebook/folly/pull/271

Reviewed By: @meyering, @fredemmott

Differential Revision: D2283975

fb-gh-sync-id: d021f739ceead9998b8fedbbd95f22ec9fe949b2
parent 60a5636b
......@@ -48,11 +48,11 @@ void FormatValue<double>::formatHelper(
}
// 2+: for null terminator and optional sign shenanigans.
char buf[2 + std::max({
(2 + DoubleToStringConverter::kMaxFixedDigitsBeforePoint +
DoubleToStringConverter::kMaxFixedDigitsAfterPoint),
(8 + DoubleToStringConverter::kMaxExponentialDigits),
(7 + DoubleToStringConverter::kMaxPrecisionDigits)})];
char buf[2 + std::max(
2 + DoubleToStringConverter::kMaxFixedDigitsBeforePoint +
DoubleToStringConverter::kMaxFixedDigitsAfterPoint,
std::max(8 + DoubleToStringConverter::kMaxExponentialDigits,
7 + DoubleToStringConverter::kMaxPrecisionDigits))];
StringBuilder builder(buf + 1, static_cast<int> (sizeof(buf) - 1));
char plusSign;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment