{"id":6895,"date":"2014-05-15T16:43:29","date_gmt":"2014-05-15T15:43:29","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=6895"},"modified":"2026-03-26T16:43:21","modified_gmt":"2026-03-26T20:43:21","slug":"c-qa","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/embedded-software\/2014\/05\/15\/c-qa\/","title":{"rendered":"C++ Q&amp;A"},"content":{"rendered":"<p>As my <a href=\"https:\/\/blogs.mentor.com\/colinwalls\/blog\/2014\/05\/12\/exception-handling-in-c-developers-are-wary\/\" target=\"_blank\" rel=\"noopener noreferrer\">interest in C++<\/a> continues, I have been soliciting questions about C++ for embedded on various social media platforms. I you have a question, please <a href=\"mailto:colin_walls@mentor.com\" target=\"_blank\" rel=\"noopener noreferrer\">email<\/a> or tweet and I will do my best to answer it.<\/p>\n<div>\n<div><a style=\"color: #a7a7a7;text-decoration: none;font-weight: normal !important;border: none\" href=\"http:\/\/www.gettyimages.com\/detail\/AB10630\" target=\"_blank\" rel=\"noopener noreferrer\">#AB10630<\/a> \/ <a style=\"color: #a7a7a7;text-decoration: none;font-weight: normal !important;border: none\" href=\"http:\/\/www.gettyimages.com\" target=\"_blank\" rel=\"noopener noreferrer\">gettyimages.com<\/a><\/div>\n<\/div>\n<p>Here is a question that came in yesterday:<\/p>\n<p><strong>How testable is C++, specifically for constructs like abstract classes, templates, exceptions?<\/strong><\/p>\n<p>This is quite a complex question to address, partly because it can be hard to separate &#8220;testing&#8221; from &#8220;debugging&#8221;. 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].<\/p>\n<p>Maybe the questioner has a broader concern, in which case they are invited come back with clarification.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As my interest in C++ continues, I have been soliciting questions about C++ for embedded on various social media platforms&#8230;.<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[300],"industry":[],"product":[],"coauthors":[],"class_list":["post-6895","post","type-post","status-publish","format-standard","hentry","category-news","tag-embedded-software"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/6895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=6895"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/6895\/revisions"}],"predecessor-version":[{"id":10270,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/6895\/revisions\/10270"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=6895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=6895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=6895"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=6895"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=6895"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=6895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}