itoa'd you so?

Levi Pearson levi at cold.org
Wed Sep 19 15:26:06 MDT 2007


Steve <smorrey at gmail.com> writes:

> Ok now this has got me stumped what was unsafe about #2?
> Taking advantage of the type safety features in the standard lib, is
> what I was trying to show, and I have a lot of code running using
> both.  If thats unsafe, I have some patchin' to do.

OK, I reread your description of the problem, and I guess they didn't
forbid using standard libraries as I thought they did.  Using C++
streams is still serious overkill.  Anyway, your emphasis here on
'type safety' is misplaced.  The type of your function is int ->
string, and solving the problem doesn't require any typecasting at
all.  As far as type theory goes, you're setting up a map (i.e., a
function) from integers to their corresponding string representations.
Maybe you could explain better what your type safety concerns were?

Clearly, they wanted to see if you knew how to algorithmically
translate an integer to a string.  You totally punted on that problem.
See several other examples in the thread for what I imagine they were
looking for.

                --Levi



More information about the PLUG mailing list