mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Fix build with GCC
Include alternate headers when building on Win32 with a compiler other than MSVC Re-add constexpr modifier to wstring_view declarations Add _Frees_ptr_opt_ to cross-platform source annotation header Update CMake version to 3.8 Revert traditional for-loop in Number::isZero to functional version This reverts commit 49a291d9198045bdde2e16a7f7ef1b30f48c6103.
This commit is contained in:
parent
a6629c4462
commit
f6bc9d48f0
7 changed files with 15 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(calculator CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
|
|
|
@ -59,13 +59,6 @@ namespace CalcEngine
|
|||
|
||||
bool Number::IsZero() const
|
||||
{
|
||||
for (auto const& digit : Mantissa())
|
||||
{
|
||||
if (digit != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return all_of(m_mantissa.begin(), m_mantissa.end(), [](auto &&i) { return i == 0; });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ static constexpr int32_t DEFAULT_RADIX = 10;
|
|||
|
||||
static constexpr wchar_t DEFAULT_DEC_SEPARATOR = L'.';
|
||||
static constexpr wchar_t DEFAULT_GRP_SEPARATOR = L',';
|
||||
static const wstring_view DEFAULT_GRP_STR = L"3;0";
|
||||
static const wstring_view DEFAULT_NUMBER_STR = L"0";
|
||||
static constexpr wstring_view DEFAULT_GRP_STR = L"3;0";
|
||||
static constexpr wstring_view DEFAULT_NUMBER_STR = L"0";
|
||||
|
||||
// Read strings for keys, errors, trig types, etc.
|
||||
// These will be copied from the resources to local memory.
|
||||
|
|
|
@ -21,8 +21,8 @@ using namespace CalcEngine;
|
|||
|
||||
constexpr int MAX_EXPONENT = 4;
|
||||
constexpr uint32_t MAX_GROUPING_SIZE = 16;
|
||||
const wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
||||
const wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
||||
constexpr wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
||||
constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
||||
|
||||
|
||||
/****************************************************************************\
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
#define SIDS_ERR_INPUT_OVERFLOW L"119"
|
||||
#define SIDS_ERR_OUTPUT_OVERFLOW L"120"
|
||||
|
||||
__declspec(selectany) std::wstring g_sids[] =
|
||||
DECLSPEC_SELECTANY std::wstring g_sids[] =
|
||||
{
|
||||
std::wstring(SIDS_PLUS_MINUS),
|
||||
std::wstring(SIDS_C),
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <array>
|
||||
#include <string_view>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
|
||||
#include <windows.h>
|
||||
#include <winerror.h>
|
||||
|
@ -41,4 +41,10 @@
|
|||
#include "win_data_types_cross_platform.h"
|
||||
#include "sal_cross_platform.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define DECLSPEC_SELECTANY __attribute__((selectany))
|
||||
#else
|
||||
#define DECLSPEC_SELECTANY __declspec(selectany)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,3 +8,4 @@
|
|||
#define _Out_
|
||||
#define _Inout_
|
||||
#define __in_opt
|
||||
#define _Frees_ptr_opt_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue