
{"id":2083,"date":"2015-09-02T18:42:50","date_gmt":"2015-09-02T18:42:50","guid":{"rendered":"http:\/\/www.codergears.com\/Blog\/?p=2083"},"modified":"2015-09-02T18:50:22","modified_gmt":"2015-09-02T18:50:22","slug":"improve-your-c-skills-by-exploring-the-clang-test-suite","status":"publish","type":"post","link":"https:\/\/codergears.com\/Blog\/?p=2083","title":{"rendered":"Improve your C++ skills by exploring the Clang test suite."},"content":{"rendered":"<p style=\"color: #333333;\">Many resources exist talking about the better way to\u00a0learn a programming language, we can enumerate:<\/p>\n<ul style=\"color: #555555;\">\n<li>Reading a book or a magazine.<\/li>\n<li>Resources from web sites.<\/li>\n<li>From a collegue.<\/li>\n<li>Doing a training.<\/li>\n<li>Explore open source projects.<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p style=\"color: #333333;\">However it&#8217;s difficult to find resources that explains easily the \u00a0advanced C++ techniques using\u00a0mini samples and if you are interested to improve your C++ skills, it&#8217;s recommended to explore\u00a0the standards which is a very difficult task, few developers could read a big pdf with more than 1500 pages.<\/p>\n<p style=\"color: #333333;\">Another alternative way is to study some mini samples delivered with the compiler source code. Indeed some\u00a0\u00a0open source C++ compilers implement the standrads like GCC and Clang . The good news is that Clang provides a battery of tests to validate the conformance of the compiler with the standards. These samples are well implemented, easy to understand and well commented, they cover many C++ features.<\/p>\n<p style=\"color: #333333;\">You can explore these mini samples to understand better some C++ capabilities. Many test cases are available here $LLVMPATH$\\tools\\clang\\test, they concern many compiler aspects:<\/p>\n<p style=\"color: #333333;\"><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2111\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest.png\" alt=\"clangtest\" width=\"243\" height=\"522\" \/><\/a><\/p>\n<p style=\"color: #333333;\">And for the C++ syntax you can explore the mini samples from the <strong>SemaCXX<\/strong> directory which is contains many interesting test cases that cover almost all the C++ features, even the C++11\/C++14 ones.<\/p>\n<p style=\"color: #333333;\"><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2113\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest2.png\" alt=\"clangtest2\" width=\"261\" height=\"431\" \/><\/a><\/p>\n<p style=\"color: #333333;\">Let&#8217;s take as example the C style casts from the\u00a0cstyle-cast.cpp file:<\/p>\n<p style=\"color: #333333;\"><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2114\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/clangtest3.png\" alt=\"clangtest3\" width=\"568\" height=\"530\" \/><\/a><\/p>\n<p style=\"color: #333333;\">This test is very well commented and\u00a0explain all the possible casting cases, a developer could learn many interesting cases when exploring it.<\/p>\n<p style=\"color: #333333;\">Summary:<\/p>\n<p style=\"color: #333333;\">Exploring the Clang test suite could help any C++ developer to improve its programming skills, even the C++ experts could learn new things when exploring these mini samples.<\/p>\n<p style=\"color: #333333;\">\n","protected":false},"excerpt":{"rendered":"<p>Many resources exist talking about the better way to\u00a0learn a programming language, we can enumerate: Reading a book or a magazine. Resources from web sites. From a collegue. Doing a training. Explore open source projects.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2083","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2083"}],"version-history":[{"count":14,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2083\/revisions"}],"predecessor-version":[{"id":2120,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/2083\/revisions\/2120"}],"wp:attachment":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}