[Discuss] 'C' string tokenizer for those who hate strtok

David Bronaugh dbronaugh at linuxboxen.org
Fri Jun 30 01:55:49 PDT 2006


Brian Quinlan wrote:
> David Bronaugh wrote:
>> Yeah, I could write a Perl one-liner, but why bother? 
>
> You could but it is unlikely to be a piece of code that you would want 
> to maintain.
Eh? How hard is it to understand a 1-liner as opposed to a 300-line mass 
of C? Or even a 10-line Python program?

What's so hard about @foo = split(/\//, $str)?
> > Not the point.
>
> What is YOUR point? My point is that most of this arguing about 
> software engineering at the C level is moot because you are wasting 
> your time expressing such an algorithm in C in the first space - you 
> found a significant bug in the code that you rewrote and this is for a 
> problem that is completely trivial.
The point is that you're comparing apples and oranges. Perl and Python 
are both significantly slower at runtime and significantly faster to write.

If you're going to write in C, it had better be clean, well-tested, and 
high performance. Otherwise -there is no point-.

Write Ocaml. Faster than C to write, and runs at around the same speed 
as C. Oh, and it actually has error checking.

David


More information about the Discuss mailing list