286{
289
290 if (*_number ==
__T(
'\0') || iswspace((wint_t)*_number)) {
291 throw new NumericConvertException(_number, _base, 0);
292 }
293
294 NumericConvertException::Error error = NumericConvertException::NoError;
295 wchar_t* endptr =
NULL;
296 long n = wcstol(_number, &endptr, _base);
298 error = NumericConvertException::Underflow;
299 }
else if (LONG_MAX ==
n) {
300 error = NumericConvertException::Overflow;
301 }
302#if __WORDSIZE > 32
304 error = NumericConvertException::Underflow;
306 error = NumericConvertException::Overflow;
307 }
308#endif
309
310 if (NumericConvertException::NoError != error) {
311 throw new NumericConvertException(
312 error,
313 _number,
314 _base
315 );
316 }
317
318 if ((endptr && *endptr != '\0') || errno == EINVAL) {
319 throw new NumericConvertException(
320 _number,
321 _base,
322 endptr ? (endptr - _number) : 0
323 );
324 }
325
327}