As my interest in C++ continues, I have been soliciting questions about C++ for embedded on various social media platforms. I you have a question, please email or tweet and I will do my best to answer it.
Here is a question that came in yesterday:
How testable is C++, specifically for constructs like abstract classes, templates, exceptions?
This is quite a complex question to address, partly because it can be hard to separate “testing” from “debugging”. Taking these example constructs, classes and templates may largely be tested by means of instantiations. For a temple, for example, you need to write a test harness that instantiates the template using a variety of likely data types and verify that the resulting code is valid. Exception handling is a different issue. There are a finite number of exception types to test, so the test harness just needs to include code that throws each one. Then it is a question of ensuring that the right catch block is invoked for each exception [and that the code therein does what is required].
Maybe the questioner has a broader concern, in which case they are invited come back with clarification.
Posted May 15th, 2014, by Colin Walls
- malloc() – just say no
- What size drink would you like?
- Using an embedded Web server
- Row 13 – unlucky for some?
- Brillo – a brilliant OS or a scouring pad?
- How Mac and I are getting along – an interim report
- IPv6 – some guidance to the uninitiated
- Power outlets when traveling – and USB again
- Spotting the difference – subtleties of C code
- Shutting the Windows – moving to a Mac?