background preloader

C++

Facebook Twitter

Netbeans

Use gperf for efficient C/C++ command line processing. Command-line processing and the need for gperf 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, as Listing 1 shows. Listing 1. C-style command-line processing if (strtok(cmdstring, "+dumpdirectory")) { // code for printing help messages goes here } else if (strtok(cmdstring, "+dumpfile")) { // code for printing version info goes here } This is where gperf comes in.

Back to top Gperf usage pattern gperf -L C++ command_line_options.gperf > perfecthash.hpp. GECODE home. C++ FQA Lite: Defective C++ Part of C++ FQA Lite This page summarizes the major defects of the C++ programming language (listing all minor quirks would take eternity). To be fair, some of the items by themselves could be design choices, not bugs. For example, a programming language doesn't have to provide garbage collection. It's the combination of the things that makes them all problematic.

For example, the lack of garbage collection makes C++ exceptions and operator overloading inherently defective. Therefore, the problems are not listed in the order of "importance" (which is subjective anyway - different people are hit the hardest by different problems). No compile time encapsulation In naturally written C++ code, changing the private members of a class requires recompilation of the code using the class. Well, at least when all relevant code is controlled by the same team of people, the only problem is the frequent rebuilds of large parts of it.

Outstandingly complicated grammar No way to locate definitions. VTK - The Visualization Toolkit. Qt – A cross-platform application and UI framework.