Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stl/inc/string
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ _NODISCARD inline int stoi(const string& _Str, size_t* _Idx = nullptr, int _Base
_Xinvalid_argument("invalid stoi argument");
}

if (_Errno_ref == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this break icc? I mean I don't care, but that may be why we checked this in the first place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question (as we try to avoid gratuitous breaks). It shouldn't - the Intel C++ Compiler issues we've encountered have involved 80-bit long double (and occasionally new compiler intrinsics). AFAIK, there are no issues with our LLP64 assumption that sizeof(int) equals sizeof(long) equals 4 (that assumption is widespread throughout our codebase).

This was originally being checked because MSVC's STL was licensed from Dinkumware, where the upstream source code was portable to many platforms.

if (_Errno_ref == ERANGE) {
_Xout_of_range("stoi argument out of range");
}

Expand Down Expand Up @@ -276,7 +276,7 @@ _NODISCARD inline int stoi(const wstring& _Str, size_t* _Idx = nullptr, int _Bas
_Xinvalid_argument("invalid stoi argument");
}

if (_Errno_ref == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans) {
if (_Errno_ref == ERANGE) {
_Xout_of_range("stoi argument out of range");
}

Expand Down