News for hackers. Stuff that matters.
Re:The Little C Function From Hell by rcfox on Tuesday June 19, 2012 @11:42AM (#4132410)
In that case, you can be pretty certain that you need a signed integer.
Re:The Little C Function From Hell by esrauch on Tuesday June 19, 2012 @10:26PM (#4135336)
What if you only need to store negative integers?
Re:The Little C Function From Hell by duaneb on Wednesday June 20, 2012 @03:17AM (#4135953)
Isn't that the same situation as only storing signed integers? The arithmetic is just a little different.
Re:The Little C Function From Hell by ralph on Wednesday June 20, 2012 @05:41AM (#4136255)
No, you get room for one more negative int. x = x < 0 ? -x : x; is a common buggy abs(), e.g. when printing an integer. One should test if it's negative, perhaps print the '-', and then ensure it's negative for the rest of the per-digit code.