{"action":"created","issue":{"url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/712","repository_url":"https://api.github.com/repos/isocpp/CppCoreGuidelines","labels_url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/712/labels{/name}","comments_url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/712/comments","events_url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/712/events","html_url":"https://github.com/isocpp/CppCoreGuidelines/issues/712","id":173591801,"number":712,"title":"ES.100 example does not illustrate ES.100","user":{"login":"cubbimew","id":9330739,"avatar_url":"https://avatars.githubusercontent.com/u/9330739?v=3","gravatar_id":"","url":"https://api.github.com/users/cubbimew","html_url":"https://github.com/cubbimew","followers_url":"https://api.github.com/users/cubbimew/followers","following_url":"https://api.github.com/users/cubbimew/following{/other_user}","gists_url":"https://api.github.com/users/cubbimew/gists{/gist_id}","starred_url":"https://api.github.com/users/cubbimew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubbimew/subscriptions","organizations_url":"https://api.github.com/users/cubbimew/orgs","repos_url":"https://api.github.com/users/cubbimew/repos","events_url":"https://api.github.com/users/cubbimew/events{/privacy}","received_events_url":"https://api.github.com/users/cubbimew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-27T11:29:15Z","updated_at":"2016-08-28T13:57:08Z","closed_at":null,"body":"The example in ES.100 \"Don't mix signed and unsigned arithmetic\" is inappropriate:\r\n\r\n`cout << abs(x-y) << '\\n'; // wrong result`\r\n\r\nThis illustrates an attempt to use unsigned types for non-modular arithmetic (exactly what ES.102 says); no signed types are involved here, so this does not illustrate \"Don't mix\"\r\n\r\nIt also only gives \"wrong result\" prior to LWG #2192. In current C++17 WP this call to abs() is explicitly ill-formed by `26.9.2[c.math.abs]p3`\r\n\r\nI still think multiplying `-1` by `sizeof` in hope to move some file pointer or char* to the left is a better demo of the problem mixing signed and unsigned types in the same arithmetic expression (because that's one case I've seen fail in real life)"},"comment":{"url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/comments/242976250","html_url":"https://github.com/isocpp/CppCoreGuidelines/issues/712#issuecomment-242976250","issue_url":"https://api.github.com/repos/isocpp/CppCoreGuidelines/issues/712","id":242976250,"user":{"login":"cubbimew","id":9330739,"avatar_url":"https://avatars.githubusercontent.com/u/9330739?v=3","gravatar_id":"","url":"https://api.github.com/users/cubbimew","html_url":"https://github.com/cubbimew","followers_url":"https://api.github.com/users/cubbimew/followers","following_url":"https://api.github.com/users/cubbimew/following{/other_user}","gists_url":"https://api.github.com/users/cubbimew/gists{/gist_id}","starred_url":"https://api.github.com/users/cubbimew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubbimew/subscriptions","organizations_url":"https://api.github.com/users/cubbimew/orgs","repos_url":"https://api.github.com/users/cubbimew/repos","events_url":"https://api.github.com/users/cubbimew/events{/privacy}","received_events_url":"https://api.github.com/users/cubbimew/received_events","type":"User","site_admin":false},"created_at":"2016-08-28T13:57:08Z","updated_at":"2016-08-28T13:57:08Z","body":"okay, fair enough."}}
{"actor":{"display_login":"cubbimew"}}