Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

you could check if ret > ret * 10 + characters[i]-48, if so it has wrapped around and you return an error


For unsigned that could work, but signed overflow is UB.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: