News for hackers. Stuff that matters.
Re:Teaching C by bogomipz on Wednesday May 11, 2016 @02:11AM (#11672954)
Why do some people store chars to store numbers?
Re:Teaching C by pjmlp on Wednesday May 11, 2016 @05:28AM (#11673797)
Because unlike other programming languages C didn't define a type called byte, so developers were forced to use char for what is byte in saner systems programming languages.

With the caveat that unless you precede them with signed/unsigned modifiers, it is not portable.

Re:Teaching C by dgacmu on Wednesday May 11, 2016 @02:23AM (#11672997)
Because uint8_t is comparatively new. C99, IIRC, though many OSes defined their own earlier.
Re:Teaching C by douche on Wednesday May 11, 2016 @02:18AM (#11672972)
They need a char-sized number, and memory used to be a tightly-budgeted commodity.

Reminds me of this story of a game developer who magically got their game under the limit at the 11th hour

http://www.dodgycoder.net/2012/02/coding-tricks-of-game-deve...

Re:Teaching C by Kristine1975 on Wednesday May 11, 2016 @02:58AM (#11673131)
Although char should not be used to store numbers, since its signedness is implementation-defined (gcc has the switch -funsigned-chars I think to make them unsigned instead of signed). signed char/unsigned char are ok.