{"id":109463,"date":"2024-02-29T07:00:00","date_gmt":"2024-02-29T15:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=109463"},"modified":"2024-02-29T07:17:59","modified_gmt":"2024-02-29T15:17:59","slug":"20240229-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240229-00\/?p=109463\/","title":{"rendered":"If a parameter isn&#8217;t used, what should I pass?"},"content":{"rendered":"<p>There are several places in the Windows API where a parameter is used only under certain conditions and is otherwise ignored. A customer wanted to know what to pass for an unused parameter.<\/p>\n<p>&#8220;I know that it says that the <code>Format\u00adMessage<\/code> function ignores the <i>lpSource<\/i> parameter if neither <code>FORMAT_<wbr \/>MESSAGE_<wbr \/>FROM_<wbr \/>HMODULE<\/code> nor <code>FORMAT_<wbr \/>MESSAGE_<wbr \/>FROM_<wbr \/>STRING<\/code> is passed. So what should I use if I&#8217;m not passing either of those flags?&#8221;<\/p>\n<p>This is the developer version of &#8220;The computer says to press any key, but I don&#8217;t have a key called <kbd>Any<\/kbd>.&#8221;<\/p>\n<p>Instead of asking the customer to contemplate whether a parameter that is never used makes a sound, I just answered, &#8220;Just pass <code>nullptr<\/code>.&#8221;<\/p>\n<p>You sometimes see this recommendation in the Windows documentation. &#8220;Under condition X, the parameter is not used and should be zero.&#8221;<\/p>\n<p>Sometimes it&#8217;s easier to just give an answer than to engage in a philosophical discussion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It doesn&#8217;t matter what you pass, but if you have to ask, then just pass zero.<\/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":[25],"class_list":["post-109463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>It doesn&#8217;t matter what you pass, but if you have to ask, then just pass zero.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109463","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=109463"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109463\/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=109463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=109463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=109463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}