From 1ccc20a4d7164f621706f1f759ffec3e1a7b12a5 Mon Sep 17 00:00:00 2001 From: Orvid King Date: Thu, 8 Oct 2015 09:52:15 -0700 Subject: [PATCH] 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 --- folly/Format.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/folly/Format.cpp b/folly/Format.cpp index 0f67969c..64e2cae5 100644 --- a/folly/Format.cpp +++ b/folly/Format.cpp @@ -48,11 +48,11 @@ void FormatValue::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 (sizeof(buf) - 1)); char plusSign; -- 2.34.1