{"action":"created","issue":{"url":"https://api.github.com/repos/boostorg/coroutine/issues/23","labels_url":"https://api.github.com/repos/boostorg/coroutine/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/boostorg/coroutine/issues/23/comments","events_url":"https://api.github.com/repos/boostorg/coroutine/issues/23/events","html_url":"https://github.com/boostorg/coroutine/issues/23","id":107005554,"number":23,"title":"Ordered comparison of pointer with integer zero","user":{"login":"BenWiederhake","id":2690845,"avatar_url":"https://avatars.githubusercontent.com/u/2690845?v=3","gravatar_id":"","url":"https://api.github.com/users/BenWiederhake","html_url":"https://github.com/BenWiederhake","followers_url":"https://api.github.com/users/BenWiederhake/followers","following_url":"https://api.github.com/users/BenWiederhake/following{/other_user}","gists_url":"https://api.github.com/users/BenWiederhake/gists{/gist_id}","starred_url":"https://api.github.com/users/BenWiederhake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenWiederhake/subscriptions","organizations_url":"https://api.github.com/users/BenWiederhake/orgs","repos_url":"https://api.github.com/users/BenWiederhake/repos","events_url":"https://api.github.com/users/BenWiederhake/events{/privacy}","received_events_url":"https://api.github.com/users/BenWiederhake/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-17T15:05:20Z","updated_at":"2015-09-17T17:45:42Z","closed_at":null,"body":"tl;dr: Would it make sense to make a PR with all `0 < ptr` occurrences replaces by `0 != ptr`?\r\n\r\nI use gcc and boost for some little project, and want to use `-Wextra` for my code in order to prevent mistakes on my side.\r\n\r\nI see the following warning within the boost headers:\r\n\r\n    $(BOOST_ROOT)/coroutine/asymmetric_coroutine.hpp:1812:23: \\\r\n    warning: ordered comparison of pointer with integer zero [-Wextra]\r\n         BOOST_ASSERT( 0 < sp);\r\n                           ^\r\n\r\nIt seems that the whole of Boost.Coroutine is written in this style, so I guess there is some benefit to it. However, since pointers shouldn't be negative (but that's just my naive intuition speaking), the only violation would be `0 == sp`.\r\n\r\nIf my assumptions is correct, then the proposed `0 != sp` would have these advantages:\r\n\r\n- same semantics\r\n- more expressiveness (should probably compare against `NULL` or `nullptr` instead of using literal zero, but that's not so important)\r\n- no/less warnings in gcc\r\n\r\n... and no disadvantages.\r\nSo, what do you think?"},"comment":{"url":"https://api.github.com/repos/boostorg/coroutine/issues/comments/141163815","html_url":"https://github.com/boostorg/coroutine/issues/23#issuecomment-141163815","issue_url":"https://api.github.com/repos/boostorg/coroutine/issues/23","id":141163815,"user":{"login":"BenWiederhake","id":2690845,"avatar_url":"https://avatars.githubusercontent.com/u/2690845?v=3","gravatar_id":"","url":"https://api.github.com/users/BenWiederhake","html_url":"https://github.com/BenWiederhake","followers_url":"https://api.github.com/users/BenWiederhake/followers","following_url":"https://api.github.com/users/BenWiederhake/following{/other_user}","gists_url":"https://api.github.com/users/BenWiederhake/gists{/gist_id}","starred_url":"https://api.github.com/users/BenWiederhake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenWiederhake/subscriptions","organizations_url":"https://api.github.com/users/BenWiederhake/orgs","repos_url":"https://api.github.com/users/BenWiederhake/repos","events_url":"https://api.github.com/users/BenWiederhake/events{/privacy}","received_events_url":"https://api.github.com/users/BenWiederhake/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T17:45:42Z","updated_at":"2015-09-17T17:45:42Z","body":"I went for the \"0 != ptr\" style. I considered the following alternatives:\r\n\r\n- `nullptr` is specific to c++11 or higher. Bad.\r\n- `NULL` is nice, but may introduce subtle problems when trying to make sure that it's defined.\r\n- `0` is really bad, but has the least potential for subtle bugs, and is guaranteed to be as portable as the previous style."}}