Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: definition and implementation of the incrbyfloat command #67
feat: definition and implementation of the incrbyfloat command #67
Changes from all commits
b83a0c8
4c58311
6374b48
1e2718e
ea8da60
5a7050e
bcfb89c
5c041d5
25c543e
4d36b2c
99c0086
f8ff623
3030c1e
3f4e598
2083c42
760c8ec
7b68c63
51dba9f
7472003
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这里的判断应该不需要吧,你在后面已经判断了转换的pEnd是否等于字符串的长度了,这里应该冗余了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得还是留着比较好,因为我看了
strtold
这个函数,它可能会在遇到空格时停止转换,并返回到目前为止已经转换的数字,比如1 23.45
就会变成1.0
,我并不希望发生这样的事情。举个例子,我在执行
incrbyfloat test 123.45
的时候因为某些原因输入成了incrbyfloat test 12 3.45
,这时候test
会增加12.0
, 不能达到命令的预期,所以我觉得这里也是个防呆操作,只要字符串含有空格就直接抛出-1
提示转换失败会更好There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其实这个参数检查的时候应该就会检查出来吧 只接受3个参数,结果传了4个参
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是我觉得这个是公共方法,不是只有
incrbyfloat
这一个命令用到,我觉得严谨一点会更好