{"id":370,"date":"2010-06-01T06:29:08","date_gmt":"2010-06-01T13:29:08","guid":{"rendered":"http:\/\/www.airs.com\/blog\/?p=370"},"modified":"2010-06-01T06:29:08","modified_gmt":"2010-06-01T13:29:08","slug":"gcc-in-c-2","status":"publish","type":"post","link":"https:\/\/www.airs.com\/blog\/archives\/370","title":{"rendered":"GCC in C++"},"content":{"rendered":"<p>I&#8217;m very pleased to see that the GCC steering committee has <a href=\"http:\/\/gcc.gnu.org\/ml\/gcc\/2010-05\/msg00705.html\">agreed to permit GCC to be written in C++<\/a>.  At one time RMS, who is a member of the steering committee, had felt that C++ was never appropriate for systems programs like GCC.  It&#8217;s good to see that he has apparently come around.<\/p>\n<p>There has been a long effort to prepare for this, by moving GCC&#8217;s code base from C to the common subset of C and C++.  While people naturally think of C++ as an extension to C, they are different languages and there is a lot of C code which is not valid C++.  In the GCC code base, one of the biggest issues was that enums are more restricted by the type system in C++ than they are in C.  Another was that in C++ you may not use the same name as a <code>typedef<\/code> and a <code>struct<\/code> tag, except for the special case of making the struct tag be a typedef for the struct itself.<\/p>\n<p>Gabriel Dos Reis did the first substantial work on moving the GCC code base to the common subset, and many other people contributed.  I think it&#8217;s fair to say that I did the lion&#8217;s share of the work, starting with my surprise presentation on the advantages of C++ at the 2008 GCC Summit.  I did a lot of work to improve the <code>-Wc++-compat<\/code> warning option to warn about C code which was not in the C\/C++ common subset, and I did a lot of work to make GCC code compile with that option without warnings.<\/p>\n<p>C++ will not magically make the GCC code base better.  However, I believe that it will give us some useful tools to incrementally improve the code base over time, making it easier to read, easier to modify, and more efficient.  I say this not based on theory, but on my experiences with gold and with the gccgo frontend.  I&#8217;ve already started writing some <a href=\"http:\/\/gcc.gnu.org\/wiki\/CppConventions\">draft C++ coding conventions<\/a> which I hope we can use to guide our efforts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m very pleased to see that the GCC steering committee has agreed to permit GCC to be written in C++. At one time RMS, who is a member of the steering committee, had felt that C++ was never appropriate for systems programs like GCC. It&#8217;s good to see that he has apparently come around. There [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-370","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/posts\/370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/comments?post=370"}],"version-history":[{"count":1,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":371,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/posts\/370\/revisions\/371"}],"wp:attachment":[{"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/media?parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/categories?post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.airs.com\/blog\/wp-json\/wp\/v2\/tags?post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}