{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/212671274","pull_request_review_id":149356930,"id":212671274,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjY3MTI3NA==","diff_hunk":"@@ -347,12 +347,18 @@ namespace Utilities\n \n   /**\n    * A replacement for <code>std::pow</code> that allows compile-time\n-   * calculations for constant expression arguments.\n+   * calculations for constant expression arguments. The exponent @p iexp\n+   * must not be negative.\n    */\n   constexpr unsigned int\n-  pow(const unsigned int base, const unsigned int iexp)\n+  pow(const unsigned int base, const int iexp)\n   {\n-    return iexp == 0 ? 1 : base * dealii::Utilities::pow(base, iexp - 1);\n+#ifdef DEAL_II_WITH_CXX17\n+    AssertThrow(iexp >= 0, ExcMessage(\"The exponent must not be negative!\"));","path":"include/deal.II/base/utilities.h","position":14,"original_position":14,"commit_id":"31d6094e306bc58a7ec1e8017c40c45c82645bc4","original_commit_id":"31d6094e306bc58a7ec1e8017c40c45c82645bc4","user":{"login":"bangerth","id":7504421,"node_id":"MDQ6VXNlcjc1MDQ0MjE=","avatar_url":"https://avatars2.githubusercontent.com/u/7504421?v=4","gravatar_id":"","url":"https://api.github.com/users/bangerth","html_url":"https://github.com/bangerth","followers_url":"https://api.github.com/users/bangerth/followers","following_url":"https://api.github.com/users/bangerth/following{/other_user}","gists_url":"https://api.github.com/users/bangerth/gists{/gist_id}","starred_url":"https://api.github.com/users/bangerth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangerth/subscriptions","organizations_url":"https://api.github.com/users/bangerth/orgs","repos_url":"https://api.github.com/users/bangerth/repos","events_url":"https://api.github.com/users/bangerth/events{/privacy}","received_events_url":"https://api.github.com/users/bangerth/received_events","type":"User","site_admin":false},"body":"Hm, that's no more true than almost any other function in deal.II as well. Is the function called from paths that, for example, directly read from input files?","created_at":"2018-08-24T15:44:02Z","updated_at":"2018-08-24T15:44:02Z","html_url":"https://github.com/dealii/dealii/pull/7113#discussion_r212671274","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/7113","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/212671274"},"html":{"href":"https://github.com/dealii/dealii/pull/7113#discussion_r212671274"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/7113"}},"in_reply_to_id":212665747},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/7113","id":210690628,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNjkwNjI4","html_url":"https://github.com/dealii/dealii/pull/7113","diff_url":"https://github.com/dealii/dealii/pull/7113.diff","patch_url":"https://github.com/dealii/dealii/pull/7113.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/7113","number":7113,"state":"open","locked":false,"title":"Assert non-negative exponents in Utilities::pow","user":{"login":"masterleinad","id":2423533,"node_id":"MDQ6VXNlcjI0MjM1MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/2423533?v=4","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"body":"I faced some problems when accidentally passing negative exponents to `Utilities::pow`.\r\nSince the exponent has been an `unsigned int`, it just created an enormous call stack which finally aborted the program. Since we are returning an `unsigned int` even an exponent larger than 31 would just lead to an overflow.\r\nThis PR changes the type of the exponent to `int` so that we can test for negative numbers.\r\nIn case we have `C++17` support, it also asserts that the exponent is non-negative. Otherwise, the exponent is treated the same as 0, i.e., 1 is returned.\r\nFinally, a more efficient \"exponentiation by squaring\" algorithm is used. \r\nDue to `C++11`'s limitations for `constexpr` everything had to fit in one statement unfortunately.","created_at":"2018-08-24T09:43:51Z","updated_at":"2018-08-24T15:44:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49f2e677d3f86c3030a4eb7be90c221b2ecd3031","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/7113/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/7113/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/7113/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/31d6094e306bc58a7ec1e8017c40c45c82645bc4","head":{"label":"masterleinad:assert_positive_exponent_pow","ref":"assert_positive_exponent_pow","sha":"31d6094e306bc58a7ec1e8017c40c45c82645bc4","user":{"login":"masterleinad","id":2423533,"node_id":"MDQ6VXNlcjI0MjM1MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/2423533?v=4","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"repo":{"id":22077233,"node_id":"MDEwOlJlcG9zaXRvcnkyMjA3NzIzMw==","name":"dealii","full_name":"masterleinad/dealii","owner":{"login":"masterleinad","id":2423533,"node_id":"MDQ6VXNlcjI0MjM1MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/2423533?v=4","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/masterleinad/dealii","description":null,"fork":true,"url":"https://api.github.com/repos/masterleinad/dealii","forks_url":"https://api.github.com/repos/masterleinad/dealii/forks","keys_url":"https://api.github.com/repos/masterleinad/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/masterleinad/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/masterleinad/dealii/teams","hooks_url":"https://api.github.com/repos/masterleinad/dealii/hooks","issue_events_url":"https://api.github.com/repos/masterleinad/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/masterleinad/dealii/events","assignees_url":"https://api.github.com/repos/masterleinad/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/masterleinad/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/masterleinad/dealii/tags","blobs_url":"https://api.github.com/repos/masterleinad/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/masterleinad/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/masterleinad/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/masterleinad/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/masterleinad/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/masterleinad/dealii/languages","stargazers_url":"https://api.github.com/repos/masterleinad/dealii/stargazers","contributors_url":"https://api.github.com/repos/masterleinad/dealii/contributors","subscribers_url":"https://api.github.com/repos/masterleinad/dealii/subscribers","subscription_url":"https://api.github.com/repos/masterleinad/dealii/subscription","commits_url":"https://api.github.com/repos/masterleinad/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/masterleinad/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/masterleinad/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/masterleinad/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/masterleinad/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/masterleinad/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/masterleinad/dealii/merges","archive_url":"https://api.github.com/repos/masterleinad/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/masterleinad/dealii/downloads","issues_url":"https://api.github.com/repos/masterleinad/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/masterleinad/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/masterleinad/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/masterleinad/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/masterleinad/dealii/labels{/name}","releases_url":"https://api.github.com/repos/masterleinad/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/masterleinad/dealii/deployments","created_at":"2014-07-21T19:26:56Z","updated_at":"2018-07-02T15:05:40Z","pushed_at":"2018-08-24T13:14:36Z","git_url":"git://github.com/masterleinad/dealii.git","ssh_url":"git@github.com:masterleinad/dealii.git","clone_url":"https://github.com/masterleinad/dealii.git","svn_url":"https://github.com/masterleinad/dealii","homepage":null,"size":216207,"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,"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":"dealii:master","ref":"master","sha":"8b4058c747d0fb3840695aa013fdb4dfa332b200","user":{"login":"dealii","id":7506070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDYwNzA=","avatar_url":"https://avatars3.githubusercontent.com/u/7506070?v=4","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"repo":{"id":21943980,"node_id":"MDEwOlJlcG9zaXRvcnkyMTk0Mzk4MA==","name":"dealii","full_name":"dealii/dealii","owner":{"login":"dealii","id":7506070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDYwNzA=","avatar_url":"https://avatars3.githubusercontent.com/u/7506070?v=4","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dealii/dealii","description":"The development repository for the deal.II finite element library.","fork":false,"url":"https://api.github.com/repos/dealii/dealii","forks_url":"https://api.github.com/repos/dealii/dealii/forks","keys_url":"https://api.github.com/repos/dealii/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dealii/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dealii/dealii/teams","hooks_url":"https://api.github.com/repos/dealii/dealii/hooks","issue_events_url":"https://api.github.com/repos/dealii/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/dealii/dealii/events","assignees_url":"https://api.github.com/repos/dealii/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/dealii/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/dealii/dealii/tags","blobs_url":"https://api.github.com/repos/dealii/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dealii/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dealii/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/dealii/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/dealii/dealii/languages","stargazers_url":"https://api.github.com/repos/dealii/dealii/stargazers","contributors_url":"https://api.github.com/repos/dealii/dealii/contributors","subscribers_url":"https://api.github.com/repos/dealii/dealii/subscribers","subscription_url":"https://api.github.com/repos/dealii/dealii/subscription","commits_url":"https://api.github.com/repos/dealii/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/dealii/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/dealii/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/dealii/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/dealii/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/dealii/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dealii/dealii/merges","archive_url":"https://api.github.com/repos/dealii/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dealii/dealii/downloads","issues_url":"https://api.github.com/repos/dealii/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/dealii/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/dealii/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/dealii/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dealii/dealii/labels{/name}","releases_url":"https://api.github.com/repos/dealii/dealii/releases{/id}","deployments_url":"https://api.github.com/repos/dealii/dealii/deployments","created_at":"2014-07-17T14:00:26Z","updated_at":"2018-08-24T04:22:31Z","pushed_at":"2018-08-24T13:37:33Z","git_url":"git://github.com/dealii/dealii.git","ssh_url":"git@github.com:dealii/dealii.git","clone_url":"https://github.com/dealii/dealii.git","svn_url":"https://github.com/dealii/dealii","homepage":"http://www.dealii.org/","size":200631,"stargazers_count":363,"watchers_count":363,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":317,"mirror_url":null,"archived":false,"open_issues_count":299,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":317,"open_issues":299,"watchers":363,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/7113"},"html":{"href":"https://github.com/dealii/dealii/pull/7113"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/7113"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/7113/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/7113/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/7113/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/31d6094e306bc58a7ec1e8017c40c45c82645bc4"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"bangerth"}}