Since strcat has to scan through the destination string every time looking for null terminators each time, again and again, C strings were much slower than they needed to be, didn't scale well, and were obsolete. That's why Brian Kernighan got Fired at his job several times as a C programmer.
Brian Kernighan got fired as a C programmer, but had plenty of C like life experience. Brian finally gets a job as a street painter, painting dotted lines down the middle of a road. On the first day he takes a can of paint out to the road and finishes 300 yards of the road. "That's pretty good!" says his boss, "you're a fast worker!" and pays him a kopeck.
The next day Brian Kernighan only gets 150 yards done. "Well, that's not nearly as good as yesterday, but you're still a fast worker Brian. 150 yards is respectable," and pays Kernighan a kopeck.
The next day Kernighan paints 30 yards of the road. "Only 30!" shouts his boss. "That's unacceptable Brian! On the first day you did ten times that much work! What's going on?"
"I can't help it," says Kernighan. "Every day I get farther and farther away from the paint can!"
For more information on this true story from "The life and times of Brian Kernighan" see Joel On Software Regarding C versus Pascal Strings
|