{"action":"created","comment":{"url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/comments/151858052","pull_request_review_id":77636683,"id":151858052,"diff_hunk":"@@ -229,60 +300,81 @@ class PascalCase\n };\n ```\n \n-### Macro Names\n+### Macro names\n When naming macros, use uppercase for all the letters, and separate words by underscores.\n \n ```C++\n #define VALID\n #define UPPERCASE_VALID\n ```\n \n-### Exceptions to Naming Rules\n+### Exceptions to naming rules\n If you are naming something that is analogous to an existing C++ entity then you can follow the existing naming convention scheme.\n ```C++\n sparse_hash_set<> ...  // STL-like entity; follows STL naming conventions\n long BUFFER_MAX ...    // a constant, as in INT_MAX\n using diff_t ...       // as in ptrdiff_t\n ```\n \n-## Braces\n-When using braces, put them on their own lines. `for`s, `if`s and loops that have one line statements, omit the braces (unless 1. between `do` and `while` on do-while statements, 2. dangling else).\n+## Including header files\n+When including header files, only include files that are _portable_ across all compilers (Unless where applicable). Do not include `<bits/stdc++.h>`.\n+\n+Pay attention to whether the header is _not in use_, and do not include it if so. If only the implementation uses it, then include the file in .cpp, not .hpp.\n \n ```C++\n-int main()\n-{\n-    if (condition) \n-    {\n-        statement;\n-        statement;\n-    }\n-    else\n-        statement;\n+// sample1.hpp\n+#include <vector>       // ok, return type is vector\n \n-    if (condition)\n-    {\n-        if (condition)\n-            statement;\n-        else\n-            statement;\n-    }\n+template<typename Ty>\n+std::vector<Ty> toVector(Ty t[], size_t sz);\n \n-    for (;condition;)\n-       statement;\n \n-    do\n-    {\n-        statement;\n-    } while (condition);\n+// sample2.hpp\n+class ListHelp\n+{\n+    void sort();\n+};\n+\n+// sample2.cpp\n+#include \"sample2.hpp\"\n+#include <utility>      // ok, only use the swap function in implementation\n+using namespace std;\n+\n+void ListHelp::sort()\n+{\n+    // use the swap function\n }\n ```\n \n-On a side note, for conditionals and loops, put a space between the keyword and the opening parentheses, and another space after the closing parentheses.\n+## Namespaces\n+When using namespace, pay attention to name collisions/name conflicts:\n \n-When using class initialization with braces, then place a space after the opening brace, and before the closing brace.\n+In header files, do not use `using` directive or declaration.\n \n ```C++\n-ClassName objectName{ 1, 4 };\n+// sample1.hpp\n+#include <vector>\n+\n+// ok, if users include this file, they also need declare std namespace to use member of vector","path":"guides/coding_style/c++/README.md","position":384,"original_position":384,"commit_id":"796e62c4d91c8755032be2307e519ab20cf0cab5","original_commit_id":"796e62c4d91c8755032be2307e519ab20cf0cab5","user":{"login":"arnavb","id":30810402,"avatar_url":"https://avatars0.githubusercontent.com/u/30810402?v=4","gravatar_id":"","url":"https://api.github.com/users/arnavb","html_url":"https://github.com/arnavb","followers_url":"https://api.github.com/users/arnavb/followers","following_url":"https://api.github.com/users/arnavb/following{/other_user}","gists_url":"https://api.github.com/users/arnavb/gists{/gist_id}","starred_url":"https://api.github.com/users/arnavb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnavb/subscriptions","organizations_url":"https://api.github.com/users/arnavb/orgs","repos_url":"https://api.github.com/users/arnavb/repos","events_url":"https://api.github.com/users/arnavb/events{/privacy}","received_events_url":"https://api.github.com/users/arnavb/received_events","type":"User","site_admin":false},"body":"need _to_ declare.","created_at":"2017-11-19T08:28:31Z","updated_at":"2017-11-19T08:29:25Z","html_url":"https://github.com/OpenGenus/cosmos/pull/3064#discussion_r151858052","pull_request_url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/comments/151858052"},"html":{"href":"https://github.com/OpenGenus/cosmos/pull/3064#discussion_r151858052"},"pull_request":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064"}}},"pull_request":{"url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064","id":153479744,"html_url":"https://github.com/OpenGenus/cosmos/pull/3064","diff_url":"https://github.com/OpenGenus/cosmos/pull/3064.diff","patch_url":"https://github.com/OpenGenus/cosmos/pull/3064.patch","issue_url":"https://api.github.com/repos/OpenGenus/cosmos/issues/3064","number":3064,"state":"open","locked":false,"title":"Coding style","user":{"login":"iattempt","id":22850435,"avatar_url":"https://avatars0.githubusercontent.com/u/22850435?v=4","gravatar_id":"","url":"https://api.github.com/users/iattempt","html_url":"https://github.com/iattempt","followers_url":"https://api.github.com/users/iattempt/followers","following_url":"https://api.github.com/users/iattempt/following{/other_user}","gists_url":"https://api.github.com/users/iattempt/gists{/gist_id}","starred_url":"https://api.github.com/users/iattempt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iattempt/subscriptions","organizations_url":"https://api.github.com/users/iattempt/orgs","repos_url":"https://api.github.com/users/iattempt/repos","events_url":"https://api.github.com/users/iattempt/events{/privacy}","received_events_url":"https://api.github.com/users/iattempt/received_events","type":"User","site_admin":false},"body":"**Fixes issue:**\r\n\r\n**Changes:**\r\n1. change order and rename\r\n2. add space and newline rules","created_at":"2017-11-19T03:51:11Z","updated_at":"2017-11-19T08:29:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d108c1c8c0560d5e7d243f6e883426ad61e55cf","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064/commits","review_comments_url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064/comments","review_comment_url":"https://api.github.com/repos/OpenGenus/cosmos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenGenus/cosmos/issues/3064/comments","statuses_url":"https://api.github.com/repos/OpenGenus/cosmos/statuses/796e62c4d91c8755032be2307e519ab20cf0cab5","head":{"label":"iattempt:coding-style","ref":"coding-style","sha":"796e62c4d91c8755032be2307e519ab20cf0cab5","user":{"login":"iattempt","id":22850435,"avatar_url":"https://avatars0.githubusercontent.com/u/22850435?v=4","gravatar_id":"","url":"https://api.github.com/users/iattempt","html_url":"https://github.com/iattempt","followers_url":"https://api.github.com/users/iattempt/followers","following_url":"https://api.github.com/users/iattempt/following{/other_user}","gists_url":"https://api.github.com/users/iattempt/gists{/gist_id}","starred_url":"https://api.github.com/users/iattempt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iattempt/subscriptions","organizations_url":"https://api.github.com/users/iattempt/orgs","repos_url":"https://api.github.com/users/iattempt/repos","events_url":"https://api.github.com/users/iattempt/events{/privacy}","received_events_url":"https://api.github.com/users/iattempt/received_events","type":"User","site_admin":false},"repo":{"id":107002792,"name":"cosmos","full_name":"iattempt/cosmos","owner":{"login":"iattempt","id":22850435,"avatar_url":"https://avatars0.githubusercontent.com/u/22850435?v=4","gravatar_id":"","url":"https://api.github.com/users/iattempt","html_url":"https://github.com/iattempt","followers_url":"https://api.github.com/users/iattempt/followers","following_url":"https://api.github.com/users/iattempt/following{/other_user}","gists_url":"https://api.github.com/users/iattempt/gists{/gist_id}","starred_url":"https://api.github.com/users/iattempt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iattempt/subscriptions","organizations_url":"https://api.github.com/users/iattempt/orgs","repos_url":"https://api.github.com/users/iattempt/repos","events_url":"https://api.github.com/users/iattempt/events{/privacy}","received_events_url":"https://api.github.com/users/iattempt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iattempt/cosmos","description":" [Show :heart: love by 🌟] Your personal library of every algorithm and data structure code that you will ever encounter","fork":true,"url":"https://api.github.com/repos/iattempt/cosmos","forks_url":"https://api.github.com/repos/iattempt/cosmos/forks","keys_url":"https://api.github.com/repos/iattempt/cosmos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iattempt/cosmos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iattempt/cosmos/teams","hooks_url":"https://api.github.com/repos/iattempt/cosmos/hooks","issue_events_url":"https://api.github.com/repos/iattempt/cosmos/issues/events{/number}","events_url":"https://api.github.com/repos/iattempt/cosmos/events","assignees_url":"https://api.github.com/repos/iattempt/cosmos/assignees{/user}","branches_url":"https://api.github.com/repos/iattempt/cosmos/branches{/branch}","tags_url":"https://api.github.com/repos/iattempt/cosmos/tags","blobs_url":"https://api.github.com/repos/iattempt/cosmos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iattempt/cosmos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iattempt/cosmos/git/refs{/sha}","trees_url":"https://api.github.com/repos/iattempt/cosmos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iattempt/cosmos/statuses/{sha}","languages_url":"https://api.github.com/repos/iattempt/cosmos/languages","stargazers_url":"https://api.github.com/repos/iattempt/cosmos/stargazers","contributors_url":"https://api.github.com/repos/iattempt/cosmos/contributors","subscribers_url":"https://api.github.com/repos/iattempt/cosmos/subscribers","subscription_url":"https://api.github.com/repos/iattempt/cosmos/subscription","commits_url":"https://api.github.com/repos/iattempt/cosmos/commits{/sha}","git_commits_url":"https://api.github.com/repos/iattempt/cosmos/git/commits{/sha}","comments_url":"https://api.github.com/repos/iattempt/cosmos/comments{/number}","issue_comment_url":"https://api.github.com/repos/iattempt/cosmos/issues/comments{/number}","contents_url":"https://api.github.com/repos/iattempt/cosmos/contents/{+path}","compare_url":"https://api.github.com/repos/iattempt/cosmos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iattempt/cosmos/merges","archive_url":"https://api.github.com/repos/iattempt/cosmos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iattempt/cosmos/downloads","issues_url":"https://api.github.com/repos/iattempt/cosmos/issues{/number}","pulls_url":"https://api.github.com/repos/iattempt/cosmos/pulls{/number}","milestones_url":"https://api.github.com/repos/iattempt/cosmos/milestones{/number}","notifications_url":"https://api.github.com/repos/iattempt/cosmos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iattempt/cosmos/labels{/name}","releases_url":"https://api.github.com/repos/iattempt/cosmos/releases{/id}","deployments_url":"https://api.github.com/repos/iattempt/cosmos/deployments","created_at":"2017-10-15T10:32:51Z","updated_at":"2017-10-15T10:32:54Z","pushed_at":"2017-11-19T06:44:19Z","git_url":"git://github.com/iattempt/cosmos.git","ssh_url":"git@github.com:iattempt/cosmos.git","clone_url":"https://github.com/iattempt/cosmos.git","svn_url":"https://github.com/iattempt/cosmos","homepage":"","size":11379,"stargazers_count":0,"watchers_count":0,"language":"C++","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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenGenus:master","ref":"master","sha":"e7a224fd0bba1cca98ddca2c8a77f2b0344bc7da","user":{"login":"OpenGenus","id":18506046,"avatar_url":"https://avatars3.githubusercontent.com/u/18506046?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenGenus","html_url":"https://github.com/OpenGenus","followers_url":"https://api.github.com/users/OpenGenus/followers","following_url":"https://api.github.com/users/OpenGenus/following{/other_user}","gists_url":"https://api.github.com/users/OpenGenus/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGenus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGenus/subscriptions","organizations_url":"https://api.github.com/users/OpenGenus/orgs","repos_url":"https://api.github.com/users/OpenGenus/repos","events_url":"https://api.github.com/users/OpenGenus/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGenus/received_events","type":"Organization","site_admin":false},"repo":{"id":103749180,"name":"cosmos","full_name":"OpenGenus/cosmos","owner":{"login":"OpenGenus","id":18506046,"avatar_url":"https://avatars3.githubusercontent.com/u/18506046?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenGenus","html_url":"https://github.com/OpenGenus","followers_url":"https://api.github.com/users/OpenGenus/followers","following_url":"https://api.github.com/users/OpenGenus/following{/other_user}","gists_url":"https://api.github.com/users/OpenGenus/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGenus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGenus/subscriptions","organizations_url":"https://api.github.com/users/OpenGenus/orgs","repos_url":"https://api.github.com/users/OpenGenus/repos","events_url":"https://api.github.com/users/OpenGenus/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGenus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenGenus/cosmos","description":"Algorithms that run our universe | Your personal library of every algorithm and data structure code that you will ever encounter","fork":false,"url":"https://api.github.com/repos/OpenGenus/cosmos","forks_url":"https://api.github.com/repos/OpenGenus/cosmos/forks","keys_url":"https://api.github.com/repos/OpenGenus/cosmos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenGenus/cosmos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenGenus/cosmos/teams","hooks_url":"https://api.github.com/repos/OpenGenus/cosmos/hooks","issue_events_url":"https://api.github.com/repos/OpenGenus/cosmos/issues/events{/number}","events_url":"https://api.github.com/repos/OpenGenus/cosmos/events","assignees_url":"https://api.github.com/repos/OpenGenus/cosmos/assignees{/user}","branches_url":"https://api.github.com/repos/OpenGenus/cosmos/branches{/branch}","tags_url":"https://api.github.com/repos/OpenGenus/cosmos/tags","blobs_url":"https://api.github.com/repos/OpenGenus/cosmos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenGenus/cosmos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenGenus/cosmos/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenGenus/cosmos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenGenus/cosmos/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenGenus/cosmos/languages","stargazers_url":"https://api.github.com/repos/OpenGenus/cosmos/stargazers","contributors_url":"https://api.github.com/repos/OpenGenus/cosmos/contributors","subscribers_url":"https://api.github.com/repos/OpenGenus/cosmos/subscribers","subscription_url":"https://api.github.com/repos/OpenGenus/cosmos/subscription","commits_url":"https://api.github.com/repos/OpenGenus/cosmos/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenGenus/cosmos/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenGenus/cosmos/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenGenus/cosmos/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenGenus/cosmos/contents/{+path}","compare_url":"https://api.github.com/repos/OpenGenus/cosmos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenGenus/cosmos/merges","archive_url":"https://api.github.com/repos/OpenGenus/cosmos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenGenus/cosmos/downloads","issues_url":"https://api.github.com/repos/OpenGenus/cosmos/issues{/number}","pulls_url":"https://api.github.com/repos/OpenGenus/cosmos/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenGenus/cosmos/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenGenus/cosmos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenGenus/cosmos/labels{/name}","releases_url":"https://api.github.com/repos/OpenGenus/cosmos/releases{/id}","deployments_url":"https://api.github.com/repos/OpenGenus/cosmos/deployments","created_at":"2017-09-16T12:07:05Z","updated_at":"2017-11-19T04:28:47Z","pushed_at":"2017-11-19T08:19:08Z","git_url":"git://github.com/OpenGenus/cosmos.git","ssh_url":"git@github.com:OpenGenus/cosmos.git","clone_url":"https://github.com/OpenGenus/cosmos.git","svn_url":"https://github.com/OpenGenus/cosmos","homepage":"http://search.opengenus.org","size":11367,"stargazers_count":5047,"watchers_count":5047,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1678,"mirror_url":null,"archived":false,"open_issues_count":906,"forks":1678,"open_issues":906,"watchers":5047,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064"},"html":{"href":"https://github.com/OpenGenus/cosmos/pull/3064"},"issue":{"href":"https://api.github.com/repos/OpenGenus/cosmos/issues/3064"},"comments":{"href":"https://api.github.com/repos/OpenGenus/cosmos/issues/3064/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenGenus/cosmos/pulls/3064/commits"},"statuses":{"href":"https://api.github.com/repos/OpenGenus/cosmos/statuses/796e62c4d91c8755032be2307e519ab20cf0cab5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"arnavb"}}