Use gperf for Efficient C/C++ Command Line Processing
Aug 01, 2007, 04:00 (4 Talkback[s])
(Other stories by Arpan Sen, Rahul Kumar Kardam)
No-Size-Fits-All! An Application-Down Approach for Your Cloud Transformation REGISTER >
[ Thanks to An Anonymous Reader for
this link. ]
"The GNU tool gperf is a 'perfect' hash function that, for a
given set of user-provided strings, generates C/C++ code for a hash
table, a hash function, and a lookup function. Learn how to use
gperf for effective command-line processing in your C/C++ code.
"Command-line processing is historically one of the most ignored
areas in software development. Just about any relatively
complicated software has dozens of available command-line options.
In fact, it's not uncommon to find hundreds of lines of if-else
statements coded to process user input, and maintenance of such
legacy code becomes a time-consuming affair even for seasoned
programmers. In such circumstances, most C developers commonly go
for a rather long (and often nested) if-else statement with ANSI C
library functions such as strcmp, strcasecmp, and strtok thrown in
for good measure..."