M
Malcolm
To be fair it is meant to be teaching code.[email protected] said:[X-posted, and followups set]
I found something interesting on the Web today, purely by chance.
It would be funny if it weren't so sad. Or sad if it weren't so funny.
I'm
not sure which.
http://www.developerdotstar.com/community/node/291
[ snip ]
[ .... ] I'm not sure
what to make of string2number, but perhaps there's a good reason
I'm not thinking of to not use one of the library functions (e.g.,
atoi or strtol) that would seem to accomplish the same thing.
Because in fact few actually existing C environments conform to the
most current Standard I decided to roll my own. I was at the time
engaged in a global computing project for people who can't afford clean
water, let alone rush out and buy a conforming implementation.
There may be no point in following up here, since Mr. Nilges says
he's left the building. In case he changes his mind, though:
And yet you have no qualms about using other library functions --
strlen, strcmp, strcat, and printf being the ones I noticed in a
quick (re)scan through the code.
Seems inconsistent, but perhaps you aren't bothered by that.
In real code one would of course use strtol() to obtain a safe conversion of
an integer. It is such a common operation that a function has been provided.
However the function isn't difficult to write, so I can see that students
might want their own version of it. printf() has to be provided as a "magic
function". beginners probably only have a very hazy idea of how it works,
but they need it to see some output.
That's not the justification Nilges gives.