{"action":"created","comment":{"url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/comments/210709111","pull_request_review_id":146983319,"id":210709111,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDcwOTExMQ==","diff_hunk":"@@ -46,15 +46,36 @@ extern \"C\" {\n #define VK_HEADER_VERSION 82\n \n \n-#define VK_NULL_HANDLE 0\n+#ifdef __cplusplus\n+    struct Null_t{ explicit operator uint64_t() const { return 0; } };\n+    #define VK_NULL_HANDLE Null_t{}\n+#else\n+    #define VK_NULL_HANDLE 0\n+#endif\n         \n \n \n #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;\n \n \n #if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE)\n-#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)\n+#ifdef __cplusplus\n+        #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \\\n+            class object{ \\\n+            private: \\\n+                uint64_t h; \\\n+            public: \\\n+                object(){}; \\\n+                object( const Null_t& nh ){ h = static_cast<uint64_t>(nh); } \\\n+                explicit object( const uint64_t rh ){ h = rh; } \\\n+                operator bool() const{ return this->h; } \\","path":"include/vulkan/vulkan_core.h","position":28,"original_position":28,"commit_id":"983be81532f0b5359b824f644ce23a8f58da6844","original_commit_id":"983be81532f0b5359b824f644ce23a8f58da6844","user":{"login":"Ralith","id":104558,"node_id":"MDQ6VXNlcjEwNDU1OA==","avatar_url":"https://avatars2.githubusercontent.com/u/104558?v=4","gravatar_id":"","url":"https://api.github.com/users/Ralith","html_url":"https://github.com/Ralith","followers_url":"https://api.github.com/users/Ralith/followers","following_url":"https://api.github.com/users/Ralith/following{/other_user}","gists_url":"https://api.github.com/users/Ralith/gists{/gist_id}","starred_url":"https://api.github.com/users/Ralith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ralith/subscriptions","organizations_url":"https://api.github.com/users/Ralith/orgs","repos_url":"https://api.github.com/users/Ralith/repos","events_url":"https://api.github.com/users/Ralith/events{/privacy}","received_events_url":"https://api.github.com/users/Ralith/received_events","type":"User","site_admin":false},"body":"Actually, [`explicit bool` works in that case](https://godbolt.org/g/tAhq9K). See [discussion of the problem](https://en.cppreference.com/w/cpp/language/implicit_conversion#The_safe_bool_problem).","created_at":"2018-08-16T19:07:21Z","updated_at":"2018-08-16T19:07:21Z","html_url":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764#discussion_r210709111","pull_request_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/comments/210709111"},"html":{"href":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764#discussion_r210709111"},"pull_request":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764"}},"in_reply_to_id":210469442},"pull_request":{"url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764","id":207019573,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MDE5NTcz","html_url":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764","diff_url":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764.diff","patch_url":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764.patch","issue_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/764","number":764,"state":"open","locked":false,"title":"WIP: Allow additional handle type safety in C++","user":{"login":"krOoze","id":3791331,"node_id":"MDQ6VXNlcjM3OTEzMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3791331?v=4","gravatar_id":"","url":"https://api.github.com/users/krOoze","html_url":"https://github.com/krOoze","followers_url":"https://api.github.com/users/krOoze/followers","following_url":"https://api.github.com/users/krOoze/following{/other_user}","gists_url":"https://api.github.com/users/krOoze/gists{/gist_id}","starred_url":"https://api.github.com/users/krOoze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krOoze/subscriptions","organizations_url":"https://api.github.com/users/krOoze/orgs","repos_url":"https://api.github.com/users/krOoze/repos","events_url":"https://api.github.com/users/krOoze/events{/privacy}","received_events_url":"https://api.github.com/users/krOoze/received_events","type":"User","site_admin":false},"body":"Allow additional handle type safety in C++ through use of classes.\r\nInspired by https://stackoverflow.com/questions/51743500/why-do-non-dispatchable-handles-use-a-ptr-on-64bit-platofrms which claimed \"C and **C++** don't have strong typedefs\".\r\n\r\nPros:\r\n - proper static handle types\r\n - control over what operations and conversions are allowed over handles\r\n - Actually seems to work on Windows (https://docs.microsoft.com/en-us/cpp/build/parameter-passing claims 64 bit structs behave as integers in ABI)\r\n - prolly can be same for 32 and 64 bits platform\r\n\r\nCons:\r\n - the XML mess\r\n - overhead risk ? (if compiler is dumb)\r\n - ?\r\n\r\nWIP:\r\n - investigate ABI on other platforms (and gate this appropriatelly in the header)\r\n - investigate what operations people use (or would like to) on handles\r\n - make similar stuff for dispatchable handles\r\n\r\nAnyway, I would like your thoughts in the meantime.\r\n","created_at":"2018-08-08T14:04:42Z","updated_at":"2018-08-16T19:07:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7bbde490a587babc7aa4c73d5ba4bfc0f629456","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764/commits","review_comments_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764/comments","review_comment_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/764/comments","statuses_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/statuses/983be81532f0b5359b824f644ce23a8f58da6844","head":{"label":"krOoze:cpp_handle_type_system","ref":"cpp_handle_type_system","sha":"983be81532f0b5359b824f644ce23a8f58da6844","user":{"login":"krOoze","id":3791331,"node_id":"MDQ6VXNlcjM3OTEzMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3791331?v=4","gravatar_id":"","url":"https://api.github.com/users/krOoze","html_url":"https://github.com/krOoze","followers_url":"https://api.github.com/users/krOoze/followers","following_url":"https://api.github.com/users/krOoze/following{/other_user}","gists_url":"https://api.github.com/users/krOoze/gists{/gist_id}","starred_url":"https://api.github.com/users/krOoze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krOoze/subscriptions","organizations_url":"https://api.github.com/users/krOoze/orgs","repos_url":"https://api.github.com/users/krOoze/repos","events_url":"https://api.github.com/users/krOoze/events{/privacy}","received_events_url":"https://api.github.com/users/krOoze/received_events","type":"User","site_admin":false},"repo":{"id":57004080,"node_id":"MDEwOlJlcG9zaXRvcnk1NzAwNDA4MA==","name":"Vulkan-Docs","full_name":"krOoze/Vulkan-Docs","owner":{"login":"krOoze","id":3791331,"node_id":"MDQ6VXNlcjM3OTEzMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/3791331?v=4","gravatar_id":"","url":"https://api.github.com/users/krOoze","html_url":"https://github.com/krOoze","followers_url":"https://api.github.com/users/krOoze/followers","following_url":"https://api.github.com/users/krOoze/following{/other_user}","gists_url":"https://api.github.com/users/krOoze/gists{/gist_id}","starred_url":"https://api.github.com/users/krOoze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krOoze/subscriptions","organizations_url":"https://api.github.com/users/krOoze/orgs","repos_url":"https://api.github.com/users/krOoze/repos","events_url":"https://api.github.com/users/krOoze/events{/privacy}","received_events_url":"https://api.github.com/users/krOoze/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krOoze/Vulkan-Docs","description":"The Vulkan API Specification and related tools","fork":true,"url":"https://api.github.com/repos/krOoze/Vulkan-Docs","forks_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/forks","keys_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/teams","hooks_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/hooks","issue_events_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/issues/events{/number}","events_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/events","assignees_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/assignees{/user}","branches_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/branches{/branch}","tags_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/tags","blobs_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/languages","stargazers_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/stargazers","contributors_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/contributors","subscribers_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/subscribers","subscription_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/subscription","commits_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/contents/{+path}","compare_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/merges","archive_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/downloads","issues_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/issues{/number}","pulls_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/labels{/name}","releases_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/releases{/id}","deployments_url":"https://api.github.com/repos/krOoze/Vulkan-Docs/deployments","created_at":"2016-04-25T01:49:46Z","updated_at":"2018-08-16T17:55:31Z","pushed_at":"2018-08-16T17:56:16Z","git_url":"git://github.com/krOoze/Vulkan-Docs.git","ssh_url":"git@github.com:krOoze/Vulkan-Docs.git","clone_url":"https://github.com/krOoze/Vulkan-Docs.git","svn_url":"https://github.com/krOoze/Vulkan-Docs","homepage":null,"size":12769,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KhronosGroup:master","ref":"master","sha":"ff0c2339083b76aba0414afafdb195bba15c78d8","user":{"login":"KhronosGroup","id":1608701,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDg3MDE=","avatar_url":"https://avatars3.githubusercontent.com/u/1608701?v=4","gravatar_id":"","url":"https://api.github.com/users/KhronosGroup","html_url":"https://github.com/KhronosGroup","followers_url":"https://api.github.com/users/KhronosGroup/followers","following_url":"https://api.github.com/users/KhronosGroup/following{/other_user}","gists_url":"https://api.github.com/users/KhronosGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/KhronosGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KhronosGroup/subscriptions","organizations_url":"https://api.github.com/users/KhronosGroup/orgs","repos_url":"https://api.github.com/users/KhronosGroup/repos","events_url":"https://api.github.com/users/KhronosGroup/events{/privacy}","received_events_url":"https://api.github.com/users/KhronosGroup/received_events","type":"Organization","site_admin":false},"repo":{"id":51506618,"node_id":"MDEwOlJlcG9zaXRvcnk1MTUwNjYxOA==","name":"Vulkan-Docs","full_name":"KhronosGroup/Vulkan-Docs","owner":{"login":"KhronosGroup","id":1608701,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDg3MDE=","avatar_url":"https://avatars3.githubusercontent.com/u/1608701?v=4","gravatar_id":"","url":"https://api.github.com/users/KhronosGroup","html_url":"https://github.com/KhronosGroup","followers_url":"https://api.github.com/users/KhronosGroup/followers","following_url":"https://api.github.com/users/KhronosGroup/following{/other_user}","gists_url":"https://api.github.com/users/KhronosGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/KhronosGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KhronosGroup/subscriptions","organizations_url":"https://api.github.com/users/KhronosGroup/orgs","repos_url":"https://api.github.com/users/KhronosGroup/repos","events_url":"https://api.github.com/users/KhronosGroup/events{/privacy}","received_events_url":"https://api.github.com/users/KhronosGroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KhronosGroup/Vulkan-Docs","description":"The Vulkan API Specification and related tools","fork":false,"url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs","forks_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/forks","keys_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/teams","hooks_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/hooks","issue_events_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/events{/number}","events_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/events","assignees_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/assignees{/user}","branches_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/branches{/branch}","tags_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/tags","blobs_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/languages","stargazers_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/stargazers","contributors_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/contributors","subscribers_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/subscribers","subscription_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/subscription","commits_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/contents/{+path}","compare_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/merges","archive_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/downloads","issues_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues{/number}","pulls_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/labels{/name}","releases_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/releases{/id}","deployments_url":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/deployments","created_at":"2016-02-11T10:03:55Z","updated_at":"2018-08-16T09:04:42Z","pushed_at":"2018-08-13T13:57:22Z","git_url":"git://github.com/KhronosGroup/Vulkan-Docs.git","ssh_url":"git@github.com:KhronosGroup/Vulkan-Docs.git","clone_url":"https://github.com/KhronosGroup/Vulkan-Docs.git","svn_url":"https://github.com/KhronosGroup/Vulkan-Docs","homepage":null,"size":13201,"stargazers_count":1207,"watchers_count":1207,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":176,"mirror_url":null,"archived":false,"open_issues_count":101,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":176,"open_issues":101,"watchers":1207,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764"},"html":{"href":"https://github.com/KhronosGroup/Vulkan-Docs/pull/764"},"issue":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/764"},"comments":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/issues/764/comments"},"review_comments":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764/comments"},"review_comment":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/pulls/764/commits"},"statuses":{"href":"https://api.github.com/repos/KhronosGroup/Vulkan-Docs/statuses/983be81532f0b5359b824f644ce23a8f58da6844"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Ralith"}}