Archive for the 'C++' Category
Spirit Vs. Lex/yacc/et al.
What are the differences and when should I use one or the other?
Read more
Writing a custom check macro for the BOOST test library
In this article I demonstrate how to write your own check macros for the boost test library (not guaranteed to work in the future)
Full source code for this example can be downloaded here.
Read more
Boost Spirit Part II (Attaching Actions to Your Grammar)
In the last article we covered how to define a grammar in the boost spirit library. This article will show you how to use the data parsed by the grammar with actions. The code for this example is here.
Read more
Boost Spirit Part I (Validating Against a Grammar)
I haven’t done a post in a while, but I thought the boost spirit library was worth an entry. Spirit provides a way of specifying and parsing a custom language grammar right inline in C++ without the need for a code generator like lex/yacc. Spirit makes it so easy to specify and use a grammar that you should never hand write even the most trivial parser again.
The full code for this example can be found here.
5 commentsWhy C++ is a Dying Language
From my blog you may notice I am an inveterate C++ coder. It was the first language I taught myself after pascal and my preferred language for compact, fast code.The downfall of C++ may not be news to many, but often it is written by opponents of the language rather than those who love it and all of its quirks. So from a fan, C++, the prognosis is poor. I could write a book on this, but I tried to distill it down to article size.
Read more
Automatic Adaptation in C++
The adapter pattern is used to implement an interface required by one library in terms of an object declared in another. It’s a useful pattern, but implementing it can be a pain. You have to manually adapt objects as you get them and then you have to remember to clean up the adapter objects when you are done. Here is a way to have the compiler do it all for you in C++.
Read more
Using C++ Exceptions Effectively
C++ exceptions are often either ignored or misused. A lot of this is C++’s fault, but it is possible to create high quality, exception safe code by following some basic guidelines. To that end I’ve written an article on using C++ exceptions. It is available in docbook and HTML Michael Smit is a software engineer in Maryland who currently develops software for spacecraft, spacecraft simulators, and spacecraft control systems.
The Author
Templatized Visitor Pattern
I recently came up with a nice pattern for templatizing visitors in C++ so I thought I’d write an article about it. Basically the problem with visitors is that adding support for new features can be a real pain in the butt (Visitor pattern considered useless). This pattern helps reduce that overhead in some cases. So here is the article in both docbook and html. Michael Smit is a software engineer in Maryland who currently develops software for spacecraft, spacecraft simulators, and spacecraft control systems.
The Author