How to detect overflow when use lexical_cast??
24 Jul
2006
24 Jul
'06
11:52 a.m.
Hi,all I want to cast string to long long type and handle overflow. I tested as follow. long long somevar = lexical_cast<long long>("123456789789789798879977978789787987879879787977897897897899879978798798798");//!!!!!!!!!!!!!! But it does not throw an exception!! It seem that casting to int does not have this kind of problem. int somevar2 = lexical_cast<int>("123456789789789798879977978789787987879");//will throw an exception
6688
Age (days ago)
6688
Last active (days ago)
0 comments
1 participants
participants (1)
-
袁晓辉