{"id":29803,"date":"2006-09-08T10:00:03","date_gmt":"2006-09-08T10:00:03","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/09\/08\/const-pointers-logical-consequences\/"},"modified":"2006-09-08T10:00:03","modified_gmt":"2006-09-08T10:00:03","slug":"const-pointers-logical-consequences","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060908-03\/?p=29803","title":{"rendered":"Const pointers: Logical consequences"},"content":{"rendered":"<p>\nConsider this follow-up question to the question from last time:\n<\/p>\n<blockquote CLASS=\"q\"><p>\nWhen I call the <code>PropertySheet<\/code> function,\ncan I assume that the\n<code>phpage<\/code> field of the\n<code>PROPSHEETHEADER<\/code> structure will not be modified?\n<\/p><\/blockquote>\n<p>\nIf we take a look at the declaration of the <code>PropertySheet<\/code>\nfunction, we see that it reads like this:\n<\/p>\n<pre>\ntypedef const PROPSHEETHEADERA *LPCPROPSHEETHEADERA;\ntypedef const PROPSHEETHEADERW *LPCPROPSHEETHEADERW;\nWINCOMMCTRLAPI INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA);\nWINCOMMCTRLAPI INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW);\n<\/pre>\n<p>\nGo past all the function declaration specification goo and look\nat the parameter list.\nIt&#8217;s a <code>const<\/code> pointer to a <code>PROPSHEETHEADER<\/code>\nstructure (either ANSI or Unicode, depending on which flavor of\nthe <code>PropertySheet<\/code> function you&#8217;re calling).\n<\/p>\n<p>\nOne of the rules for const pointers is that you can read from them\nbut you cannot write to them.\nConsequently, the <code>PropertySheet<\/code> function is not allowed\nto modify the <code>PROPSHEETHEADER<\/code> structure.\nAssuming your code doesn&#8217;t modify the <code>PROPSHEETHEADER<\/code> yourself,\nany value on exit from the function will be the same\nas the value it had on entry.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider this follow-up question to the question from last time: When I call the PropertySheet function, can I assume that the phpage field of the PROPSHEETHEADER structure will not be modified? If we take a look at the declaration of the PropertySheet function, we see that it reads like this: typedef const PROPSHEETHEADERA *LPCPROPSHEETHEADERA; typedef [&hellip;]<\/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-29803","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Consider this follow-up question to the question from last time: When I call the PropertySheet function, can I assume that the phpage field of the PROPSHEETHEADER structure will not be modified? If we take a look at the declaration of the PropertySheet function, we see that it reads like this: typedef const PROPSHEETHEADERA *LPCPROPSHEETHEADERA; typedef [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/29803","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=29803"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/29803\/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=29803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=29803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=29803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}