{"id":110243,"date":"2024-09-10T07:00:00","date_gmt":"2024-09-10T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=110243"},"modified":"2024-09-10T08:44:46","modified_gmt":"2024-09-10T15:44:46","slug":"20240910-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240910-00\/?p=110243","title":{"rendered":"Does the Resource Compiler have a separate preprocessor or doesn&#8217;t it?"},"content":{"rendered":"<p>Some time ago, I noted that <a title=\"The Resource Compiler's preprocessor is not the same as the C preprocessor\" href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20171004-00\/?p=97126\"> the Resource Compiler&#8217;s preprocessor is not the same as the C preprocessor<\/a>. Michal Necasek at the <a href=\"https:\/\/www.os2museum.com\/\"> OS\/2 Museum<\/a> (highly recommended) <a href=\"https:\/\/www.os2museum.com\/wp\/from-the-annals-of-preprocessor-hackery\/\"> took issue with that statement<\/a>, noting that the strings in the <tt>rcpp.exe<\/tt> program reveal that it seems to be basically the same C preprocessor book with a different cover. So who&#8217;s right?<\/p>\n<p>We&#8217;re both right.<\/p>\n<p>The standalone <tt>rcpp.exe<\/tt> program may very well have begun as the C preprocessor, but it existed only in the 16-bit SDK. The 32-bit Resource Compiler uses a built-in preprocessor; there is no 32-bit <tt>rcpp.exe<\/tt>.<\/p>\n<p>Even though a lot of the preprocessing machinery is the same, the two have diverged. For example, the only <code>#pragma<\/code> directive supported by the Resource Compiler is <code>#pragma code_page(n)<\/code>, which is a pragma not supported by the C preprocessor at all.<\/p>\n<p><b>Bonus chatter<\/b>: Even though you can ask the C compiler to produce a preprocessed file, the C compiler internally doesn&#8217;t write the output to a file and then read it back. That is just a waypoint in the overall process of compiling. Internally, the tokens in the preprocessed output have hidden attributes (known informally in standards circles as &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Painted_blue\">blue paint<\/a>&#8220;) that don&#8217;t show up in the output, so it is not strictly the case that taking the preprocessed output and feeding it back into the compiler is a full fidelity representation of the output of the preprocessor step.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It did, but now it doesn&#8217;t.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-110243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>It did, but now it doesn&#8217;t.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=110243"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110243\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=110243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=110243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=110243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}