{"id":266,"date":"2018-01-27T21:08:18","date_gmt":"2018-01-27T21:08:18","guid":{"rendered":"http:\/\/cppdepend.com\/blog\/?p=266"},"modified":"2018-02-02T18:24:42","modified_gmt":"2018-02-02T18:24:42","slug":"improve-your-c-skills-by-exploring-the-clang-test-suite","status":"publish","type":"post","link":"https:\/\/cppdepend.com\/blog\/improve-your-c-skills-by-exploring-the-clang-test-suite\/","title":{"rendered":"Improve your C++ skills by exploring the Clang test suite."},"content":{"rendered":"<p>Many resources exist talking about the better way to\u00a0learn a programming language, we can enumerate:<\/p>\n<ul>\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>However it\u2019s 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\u2019s recommended to explore\u00a0the standards which is a very difficult task, few developers could read a big pdf with more than 1500 pages.<!--more--><\/p>\n<p>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>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><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>And for the C++ syntax you can explore the mini samples from the\u00a0<strong>SemaCXX<\/strong>\u00a0directory which is contains many interesting test cases that cover almost all the C++ features, even the C++11\/C++14 ones.<\/p>\n<p><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>Let\u2019s take as example the C style casts from the\u00a0cstyle-cast.cpp file:<\/p>\n<p><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>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>Summary:<\/p>\n<p>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","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. However it\u2019s difficult to find resources that explains easily the \u00a0advanced C++ techniques using\u00a0mini samples and if you are interested &hellip; <a href=\"https:\/\/cppdepend.com\/blog\/improve-your-c-skills-by-exploring-the-clang-test-suite\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Improve your C++ skills by exploring the Clang test suite.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,25],"class_list":["post-266","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-c","tag-clang"],"_links":{"self":[{"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/posts\/266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":2,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/posts\/266\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cppdepend.com\/blog\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}