{"action":"created","issue":{"url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/96","repository_url":"https://api.github.com/repos/OutpostUniverse/OP2Utility","labels_url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/96/comments","events_url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/96/events","html_url":"https://github.com/OutpostUniverse/OP2Utility/issues/96","id":335434634,"node_id":"MDU6SXNzdWUzMzU0MzQ2MzQ=","number":96,"title":"Clang tautological-compare warning","user":{"login":"DanRStevens","id":16793474,"node_id":"MDQ6VXNlcjE2NzkzNDc0","avatar_url":"https://avatars2.githubusercontent.com/u/16793474?v=4","gravatar_id":"","url":"https://api.github.com/users/DanRStevens","html_url":"https://github.com/DanRStevens","followers_url":"https://api.github.com/users/DanRStevens/followers","following_url":"https://api.github.com/users/DanRStevens/following{/other_user}","gists_url":"https://api.github.com/users/DanRStevens/gists{/gist_id}","starred_url":"https://api.github.com/users/DanRStevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanRStevens/subscriptions","organizations_url":"https://api.github.com/users/DanRStevens/orgs","repos_url":"https://api.github.com/users/DanRStevens/repos","events_url":"https://api.github.com/users/DanRStevens/events{/privacy}","received_events_url":"https://api.github.com/users/DanRStevens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-25T14:35:02Z","updated_at":"2018-06-27T07:49:26Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The older stock install of Clang (but curiously not the newer version) flagged some code with a warning. It does rather look like an infinite loop due to the unsigned nature of `std::size_t`:\r\n```\r\nclang -MT build/obj/XFile.o -MMD -MP -MF build/deps/XFile.Td -std=c++14 -g -Wall -Wno-unknown-pragmas  -c -o build/obj/XFile.o XFile.cpp\r\nXFile.cpp:86:47: warning: comparison of unsigned expression >= 0 is always true\r\n      [-Wtautological-compare]\r\n        for (std::size_t i = filenames.size() - 1; i >= 0; i--) \r\n                                                   ~ ^  ~\r\nXFile.cpp:104:47: warning: comparison of unsigned expression >= 0 is always true\r\n      [-Wtautological-compare]\r\n        for (std::size_t i = filenames.size() - 1; i >= 0; --i)\r\n                                                   ~ ^  ~\r\n2 warnings generated.\r\n```\r\nAlso of curious note is the inconsistency between `i--` and `--i`.\r\n\r\nThe functions in question are:\r\nhttps://github.com/OutpostUniverse/OP2Utility/blob/41ec8f877e191e200998fdc9466cc63ad88258d2/XFile.cpp#L82-L121\r\n\r\nThe following StackOverflow may provide some guidance:\r\n[Reverse iteration with an unsigned loop variable](https://stackoverflow.com/questions/3623263/reverse-iteration-with-an-unsigned-loop-variable)\r\n"},"comment":{"url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/comments/400576676","html_url":"https://github.com/OutpostUniverse/OP2Utility/issues/96#issuecomment-400576676","issue_url":"https://api.github.com/repos/OutpostUniverse/OP2Utility/issues/96","id":400576676,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDU3NjY3Ng==","user":{"login":"DanRStevens","id":16793474,"node_id":"MDQ6VXNlcjE2NzkzNDc0","avatar_url":"https://avatars2.githubusercontent.com/u/16793474?v=4","gravatar_id":"","url":"https://api.github.com/users/DanRStevens","html_url":"https://github.com/DanRStevens","followers_url":"https://api.github.com/users/DanRStevens/followers","following_url":"https://api.github.com/users/DanRStevens/following{/other_user}","gists_url":"https://api.github.com/users/DanRStevens/gists{/gist_id}","starred_url":"https://api.github.com/users/DanRStevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanRStevens/subscriptions","organizations_url":"https://api.github.com/users/DanRStevens/orgs","repos_url":"https://api.github.com/users/DanRStevens/repos","events_url":"https://api.github.com/users/DanRStevens/events{/privacy}","received_events_url":"https://api.github.com/users/DanRStevens/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T07:49:26Z","updated_at":"2018-06-27T07:49:26Z","author_association":"CONTRIBUTOR","body":"Fixed your parenthesis for you :wink: \r\n\r\nI'm fine with that. I was so used to `i++` that I stuck with it for many years even after learning about the difference and the potential for temporaries. I've recently started to use the `++i` form, but I don't think it's a big point, at least certainly not for simple integers.\r\n"}}
{"actor":{"display_login":"DanRStevens"}}