{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/comments/30916074","id":30916074,"diff_hunk":"@@ -0,0 +1,68 @@\n+\n+#include \"env.h\"\n+#include \"env-inl.h\"\n+#include \"node.h\"\n+#include \"node_internals.h\"\n+#include \"v8-profiler.h\"\n+#include \"v8.h\"\n+\n+namespace node {\n+namespace _alignof {\n+\n+using v8::Context;\n+using v8::Handle;\n+using v8::Object;\n+using v8::Persistent;\n+using v8::Uint32;\n+using v8::Value;\n+\n+\n+void Initialize(Handle<Object> exports,\n+                Handle<Value> unused,\n+                Handle<Context> context) {\n+  Environment* env = Environment::GetCurrent(context);\n+\n+#define SET_ALIGNOF(name, type) \\\n+  struct s_##name { type a; }; \\\n+  exports->Set(FIXED_ONE_BYTE_STRING(env->isolate(), #name ), \\\n+               Uint32::NewFromUnsigned(env->isolate(), static_cast<uint32_t>(__alignof__(struct s_##name))));","path":"src/alignof.cc","position":28,"original_position":28,"commit_id":"34320548ff72a4aadf94a98d678f8e42defc847a","original_commit_id":"34320548ff72a4aadf94a98d678f8e42defc847a","user":{"login":"TooTallNate","id":71256,"avatar_url":"https://avatars.githubusercontent.com/u/71256?v=3","gravatar_id":"","url":"https://api.github.com/users/TooTallNate","html_url":"https://github.com/TooTallNate","followers_url":"https://api.github.com/users/TooTallNate/followers","following_url":"https://api.github.com/users/TooTallNate/following{/other_user}","gists_url":"https://api.github.com/users/TooTallNate/gists{/gist_id}","starred_url":"https://api.github.com/users/TooTallNate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooTallNate/subscriptions","organizations_url":"https://api.github.com/users/TooTallNate/orgs","repos_url":"https://api.github.com/users/TooTallNate/repos","events_url":"https://api.github.com/users/TooTallNate/events{/privacy}","received_events_url":"https://api.github.com/users/TooTallNate/received_events","type":"User","site_admin":false},"body":"I forget we're in C++ land sometimes :) Does that mean I can ditch the struct thing?","created_at":"2015-05-22T17:48:06Z","updated_at":"2015-05-22T17:48:06Z","html_url":"https://github.com/nodejs/io.js/pull/1759#discussion_r30916074","pull_request_url":"https://api.github.com/repos/nodejs/io.js/pulls/1759","_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments/30916074"},"html":{"href":"https://github.com/nodejs/io.js/pull/1759#discussion_r30916074"},"pull_request":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1759"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/1759","id":35961711,"html_url":"https://github.com/nodejs/io.js/pull/1759","diff_url":"https://github.com/nodejs/io.js/pull/1759.diff","patch_url":"https://github.com/nodejs/io.js/pull/1759.patch","issue_url":"https://api.github.com/repos/nodejs/io.js/issues/1759","number":1759,"state":"open","locked":false,"title":"[Discussion] FFI - export `os.sizeof` and `os.alignof` mappings","user":{"login":"TooTallNate","id":71256,"avatar_url":"https://avatars.githubusercontent.com/u/71256?v=3","gravatar_id":"","url":"https://api.github.com/users/TooTallNate","html_url":"https://github.com/TooTallNate","followers_url":"https://api.github.com/users/TooTallNate/followers","following_url":"https://api.github.com/users/TooTallNate/following{/other_user}","gists_url":"https://api.github.com/users/TooTallNate/gists{/gist_id}","starred_url":"https://api.github.com/users/TooTallNate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooTallNate/subscriptions","organizations_url":"https://api.github.com/users/TooTallNate/orgs","repos_url":"https://api.github.com/users/TooTallNate/repos","events_url":"https://api.github.com/users/TooTallNate/events{/privacy}","received_events_url":"https://api.github.com/users/TooTallNate/received_events","type":"User","site_admin":false},"body":"Related to #1750.\r\n\r\nThis PR adds `os.sizeof` and `os.alignof` Object mappings. For example, on a 64-bit OS:\r\n\r\n```\r\n> os.sizeof\r\n{ int8: 1,\r\n  uint8: 1,\r\n  int16: 2,\r\n  uint16: 2,\r\n  int32: 4,\r\n  uint32: 4,\r\n  int64: 8,\r\n  uint64: 8,\r\n  float: 4,\r\n  double: 8,\r\n  bool: 1,\r\n  byte: 1,\r\n  char: 1,\r\n  uchar: 1,\r\n  short: 2,\r\n  ushort: 2,\r\n  int: 4,\r\n  uint: 4,\r\n  long: 8,\r\n  ulong: 8,\r\n  longlong: 8,\r\n  ulonglong: 8,\r\n  pointer: 8,\r\n  size_t: 8,\r\n  Object: 8 }\r\n```\r\n\r\n```\r\n> os.alignof\r\n{ int8: 1,\r\n  uint8: 1,\r\n  int16: 2,\r\n  uint16: 2,\r\n  int32: 4,\r\n  uint32: 4,\r\n  int64: 8,\r\n  uint64: 8,\r\n  float: 4,\r\n  double: 8,\r\n  bool: 1,\r\n  char: 1,\r\n  uchar: 1,\r\n  short: 2,\r\n  ushort: 2,\r\n  int: 4,\r\n  uint: 4,\r\n  long: 8,\r\n  ulong: 8,\r\n  longlong: 8,\r\n  ulonglong: 8,\r\n  pointer: 8,\r\n  size_t: 8,\r\n  Object: 8 }\r\n```\r\n\r\nHopefully pretty uncontroversial, but still needs docs and tests. Wanted to get notes/comments on implementation first though.","created_at":"2015-05-21T18:12:34Z","updated_at":"2015-05-22T17:48:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cda22b6aba8234842e0be70e79bd06ff3a42de4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/io.js/pulls/1759/commits","review_comments_url":"https://api.github.com/repos/nodejs/io.js/pulls/1759/comments","review_comment_url":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/io.js/issues/1759/comments","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/34320548ff72a4aadf94a98d678f8e42defc847a","head":{"label":"TooTallNate:idea/expose-sizeof-and-alignof","ref":"idea/expose-sizeof-and-alignof","sha":"34320548ff72a4aadf94a98d678f8e42defc847a","user":{"login":"TooTallNate","id":71256,"avatar_url":"https://avatars.githubusercontent.com/u/71256?v=3","gravatar_id":"","url":"https://api.github.com/users/TooTallNate","html_url":"https://github.com/TooTallNate","followers_url":"https://api.github.com/users/TooTallNate/followers","following_url":"https://api.github.com/users/TooTallNate/following{/other_user}","gists_url":"https://api.github.com/users/TooTallNate/gists{/gist_id}","starred_url":"https://api.github.com/users/TooTallNate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooTallNate/subscriptions","organizations_url":"https://api.github.com/users/TooTallNate/orgs","repos_url":"https://api.github.com/users/TooTallNate/repos","events_url":"https://api.github.com/users/TooTallNate/events{/privacy}","received_events_url":"https://api.github.com/users/TooTallNate/received_events","type":"User","site_admin":false},"repo":{"id":35912088,"name":"io.js","full_name":"TooTallNate/io.js","owner":{"login":"TooTallNate","id":71256,"avatar_url":"https://avatars.githubusercontent.com/u/71256?v=3","gravatar_id":"","url":"https://api.github.com/users/TooTallNate","html_url":"https://github.com/TooTallNate","followers_url":"https://api.github.com/users/TooTallNate/followers","following_url":"https://api.github.com/users/TooTallNate/following{/other_user}","gists_url":"https://api.github.com/users/TooTallNate/gists{/gist_id}","starred_url":"https://api.github.com/users/TooTallNate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TooTallNate/subscriptions","organizations_url":"https://api.github.com/users/TooTallNate/orgs","repos_url":"https://api.github.com/users/TooTallNate/repos","events_url":"https://api.github.com/users/TooTallNate/events{/privacy}","received_events_url":"https://api.github.com/users/TooTallNate/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TooTallNate/io.js","description":"What should go in this box? https://github.com/nodejs/io.js/issues/1714","fork":true,"url":"https://api.github.com/repos/TooTallNate/io.js","forks_url":"https://api.github.com/repos/TooTallNate/io.js/forks","keys_url":"https://api.github.com/repos/TooTallNate/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TooTallNate/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TooTallNate/io.js/teams","hooks_url":"https://api.github.com/repos/TooTallNate/io.js/hooks","issue_events_url":"https://api.github.com/repos/TooTallNate/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/TooTallNate/io.js/events","assignees_url":"https://api.github.com/repos/TooTallNate/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/TooTallNate/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/TooTallNate/io.js/tags","blobs_url":"https://api.github.com/repos/TooTallNate/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TooTallNate/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TooTallNate/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/TooTallNate/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TooTallNate/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/TooTallNate/io.js/languages","stargazers_url":"https://api.github.com/repos/TooTallNate/io.js/stargazers","contributors_url":"https://api.github.com/repos/TooTallNate/io.js/contributors","subscribers_url":"https://api.github.com/repos/TooTallNate/io.js/subscribers","subscription_url":"https://api.github.com/repos/TooTallNate/io.js/subscription","commits_url":"https://api.github.com/repos/TooTallNate/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/TooTallNate/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/TooTallNate/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/TooTallNate/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/TooTallNate/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/TooTallNate/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TooTallNate/io.js/merges","archive_url":"https://api.github.com/repos/TooTallNate/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TooTallNate/io.js/downloads","issues_url":"https://api.github.com/repos/TooTallNate/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/TooTallNate/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/TooTallNate/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/TooTallNate/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TooTallNate/io.js/labels{/name}","releases_url":"https://api.github.com/repos/TooTallNate/io.js/releases{/id}","created_at":"2015-05-19T22:32:11Z","updated_at":"2015-05-19T22:32:15Z","pushed_at":"2015-05-22T17:37:58Z","git_url":"git://github.com/TooTallNate/io.js.git","ssh_url":"git@github.com:TooTallNate/io.js.git","clone_url":"https://github.com/TooTallNate/io.js.git","svn_url":"https://github.com/TooTallNate/io.js","homepage":"https://iojs.org","size":130760,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"2b1c01c2cc203dd6131c3fc6238cf62a2e697f63","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"io.js","full_name":"nodejs/io.js","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/io.js","description":"What should go in this box? https://github.com/nodejs/io.js/issues/1714","fork":false,"url":"https://api.github.com/repos/nodejs/io.js","forks_url":"https://api.github.com/repos/nodejs/io.js/forks","keys_url":"https://api.github.com/repos/nodejs/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/io.js/teams","hooks_url":"https://api.github.com/repos/nodejs/io.js/hooks","issue_events_url":"https://api.github.com/repos/nodejs/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/io.js/events","assignees_url":"https://api.github.com/repos/nodejs/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/io.js/tags","blobs_url":"https://api.github.com/repos/nodejs/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/io.js/languages","stargazers_url":"https://api.github.com/repos/nodejs/io.js/stargazers","contributors_url":"https://api.github.com/repos/nodejs/io.js/contributors","subscribers_url":"https://api.github.com/repos/nodejs/io.js/subscribers","subscription_url":"https://api.github.com/repos/nodejs/io.js/subscription","commits_url":"https://api.github.com/repos/nodejs/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/io.js/merges","archive_url":"https://api.github.com/repos/nodejs/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/io.js/downloads","issues_url":"https://api.github.com/repos/nodejs/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/io.js/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/io.js/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-05-22T16:17:45Z","pushed_at":"2015-05-22T17:37:59Z","git_url":"git://github.com/nodejs/io.js.git","ssh_url":"git@github.com:nodejs/io.js.git","clone_url":"https://github.com/nodejs/io.js.git","svn_url":"https://github.com/nodejs/io.js","homepage":"https://iojs.org","size":182338,"stargazers_count":12489,"watchers_count":12489,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":928,"mirror_url":null,"open_issues_count":270,"forks":928,"open_issues":270,"watchers":12489,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1759"},"html":{"href":"https://github.com/nodejs/io.js/pull/1759"},"issue":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1759"},"comments":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1759/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1759/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1759/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/io.js/statuses/34320548ff72a4aadf94a98d678f8e42defc847a"}}}}