[comp.sources.d] shell printf - a sensible solution

ken@rochester.ARPA (Ken Yap) (03/19/87)

|With machine speed increasing all of the time, this argument is
|becoming obsolete. Until we all have 20% of a 5 mips machine, it's

Jon Bentley, in one of the programming pearls columns asks the reader
to consider how much CPU time is saved compared to programmer time.
I would guess the posted printf took more time to write than all
the CPU time it will save throughout its entire lifetime.

|On the other hand, there is another type of waste involved, and there
|is an issue of portability.

Which is why I won't use getopt in shell scripts even though it is
tempting - I can't be sure it exists on every machine the shell script
will be run on.

Yes, there is a tradeoff, but the need has to be well documented before
turning a shell script into C code. I think it was Rob Pike who noted
that "ls | mc" where mc is a multi-column filter actually runs faster
than the Berkeley "ls". I hate it everytime I do a "rsh ls" and forget
to append -C!

	Ken