News for hackers. Stuff that matters.
Re:How Effective are Technical Interviews? by Someone on Thursday February 03, 2011 @04:01PM (#2176794)
[pedantic]: you should use '0', not 0x30.

1. The standard library C function atoi may be named 'ASCII to integer', but it should convert a numerical string in the platform's encoding to integer. For symmetry, itoa should convert an integer to a platform encoded numeric string, not to an ASCII numerical string.

2. Not all computers use ASCII for C strings. Because of that, '0' need not equal 0x30. For example, in EBCDIC, one has '0' == 0xF0.

Utterly pedantic: IIRC, the C standard guarantees that '0' through '9' are contiguous and in order. If you know better, or aren't sure, use "0123456789"[i] to convert a 0...9 value to the corresponding char.

Re:How Effective are Technical Interviews? by varjag on Friday February 04, 2011 @03:21AM (#2178789)
I used 0x30 for didactic purposes, so that a person less familiar with C would understand what exactly is happening.