{"action":"created","issue":{"url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/2","repository_url":"https://api.github.com/repos/lotabout/write-a-C-interpreter","labels_url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/2/comments","events_url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/2/events","html_url":"https://github.com/lotabout/write-a-C-interpreter/issues/2","id":133526587,"number":2,"title":"step-2  xc-tutor.c 中关于数字处理的问题","user":{"login":"tangzhenhao","id":9996199,"avatar_url":"https://avatars.githubusercontent.com/u/9996199?v=3","gravatar_id":"","url":"https://api.github.com/users/tangzhenhao","html_url":"https://github.com/tangzhenhao","followers_url":"https://api.github.com/users/tangzhenhao/followers","following_url":"https://api.github.com/users/tangzhenhao/following{/other_user}","gists_url":"https://api.github.com/users/tangzhenhao/gists{/gist_id}","starred_url":"https://api.github.com/users/tangzhenhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangzhenhao/subscriptions","organizations_url":"https://api.github.com/users/tangzhenhao/orgs","repos_url":"https://api.github.com/users/tangzhenhao/repos","events_url":"https://api.github.com/users/tangzhenhao/events{/privacy}","received_events_url":"https://api.github.com/users/tangzhenhao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-14T09:55:23Z","updated_at":"2016-02-15T01:46:52Z","closed_at":"2016-02-15T01:46:52Z","body":"代码第87-113.\r\n\r\n代码中的逻辑是这样的：\r\n\r\n```c\r\ntoken_val = token - '0';\r\n if (token_val) {\r\n   //hex\r\n    if (*src == 'x' || *src == 'X') {\r\n    \r\n    }else{\r\n  // dec\r\n    }\r\n}\r\nelse\r\n{\r\n//oct\r\n}\r\n```\r\n\r\n我觉得逻辑应该是这样的，调换一下dec和oct的代码位置：\r\n\r\n```c\r\ntoken_val = token - '0';\r\n if (token_val) {\r\n   //hex\r\n    if (*src == 'x' || *src == 'X') {\r\n    \r\n    }else{\r\n  // oct\r\n    }\r\n}\r\nelse\r\n{\r\n//dec\r\n}\r\n```\r\n\r\ngithub上这样写对十六进制和八进制是没有影响的，作者只测试了十进制，所以没发现吧，把hello.c 中的数字换成十六进制一试便知。请lotabout再看一眼git上的代码吧。"},"comment":{"url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/comments/184022399","html_url":"https://github.com/lotabout/write-a-C-interpreter/issues/2#issuecomment-184022399","issue_url":"https://api.github.com/repos/lotabout/write-a-C-interpreter/issues/2","id":184022399,"user":{"login":"lotabout","id":1527040,"avatar_url":"https://avatars.githubusercontent.com/u/1527040?v=3","gravatar_id":"","url":"https://api.github.com/users/lotabout","html_url":"https://github.com/lotabout","followers_url":"https://api.github.com/users/lotabout/followers","following_url":"https://api.github.com/users/lotabout/following{/other_user}","gists_url":"https://api.github.com/users/lotabout/gists{/gist_id}","starred_url":"https://api.github.com/users/lotabout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotabout/subscriptions","organizations_url":"https://api.github.com/users/lotabout/orgs","repos_url":"https://api.github.com/users/lotabout/repos","events_url":"https://api.github.com/users/lotabout/events{/privacy}","received_events_url":"https://api.github.com/users/lotabout/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T01:46:52Z","updated_at":"2016-02-15T01:46:52Z","body":"Hi,\r\n\r\n你的代码是正确的，我的确只测试了十进制。在博客里有评论指出了这点，我也做了相应的修改。\r\n\r\n只是当时只修改到 master 分支上。现在也修改到了其它的 step 分支上了。对你造成了不便，十分抱歉。\r\n\r\nP.S. 在 Github 上贴代码可以用 markdown 的代码块，这样不会有格式的问题，同时还有高亮。"}}