{"id":459,"date":"2021-02-17T18:19:40","date_gmt":"2021-02-17T18:19:40","guid":{"rendered":"http:\/\/qedevelopment.co.uk\/?p=459"},"modified":"2021-02-17T18:19:41","modified_gmt":"2021-02-17T18:19:41","slug":"cpplint-how-to-disable-warnings","status":"publish","type":"post","link":"https:\/\/qedevelopment.co.uk\/?p=459","title":{"rendered":"cpplint: How to disable warnings"},"content":{"rendered":"\n<p>Cpplint is an open source tool used to check source code against the Google C++ Style Guide. The code is run from the command line as shown below, and results in output similar to that shown<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cpplint file1.cpp\nfile.cpp:1: Include the directory when naming .h files [build\/include_subdir] [4]\nfile.cpp:2: Include the directory when naming .h files [build\/include_subdir] [4]\nfile.cpp:88: Use int16\/int64\/etc, rather than the C type long [runtime\/int] [4]\nfile.cpp:89: Use int16\/int64\/etc, rather than the C type long [runtime\/int] [4]<\/pre>\n\n\n\n<p>The style guide suggests that all header files should be listed relative to the projects source directory without use of unix aliases such as <code>.<\/code> (current directory) or <code>..<\/code> (parent directory). As such, the format for an include of a file located at <code>project\/src\/base\/file.h<\/code> would look like<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#include \"base\/file.h\"<\/pre>\n\n\n\n<p>Where integer types are concerned the guide suggests that the only built-in integer type that should be used is <code>int<\/code>, and that all other required types should be taken from <code>&lt;stdint.h><\/code> implying that short should be replaced with <code>int16_t<\/code> and <code>long long<\/code> with <code>int64_t<\/code>. The standard also suggests that the use of unsigned types should be avoided unless they are specifically required.<\/p>\n\n\n\n<p>Supposing that you don&#8217;t want to modify your code to remove these warning messages. One solution is to call cpplint using filters as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cpplint --filter=-build\/include_subdir --filter=-runtime\/int file1.cpp<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cpplint is an open source tool used to check source code against the Google C++ Style Guide. The code is run from the command line as shown below, and results in output similar to that shown $ cpplint file1.cpp file.cpp:1: Include the directory when naming .h files [build\/include_subdir] [4] file.cpp:2: Include the directory when naming &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/qedevelopment.co.uk\/?p=459\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;cpplint: How to disable warnings&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[6,7,11],"tags":[22],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/459"}],"collection":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=459"}],"version-history":[{"count":2,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/459\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/459\/revisions\/461"}],"wp:attachment":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}