Skip to content
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

integer value for option 'CFG_INT' is out of range #171

Closed
mik1234mc opened this issue May 15, 2023 · 3 comments
Closed

integer value for option 'CFG_INT' is out of range #171

mik1234mc opened this issue May 15, 2023 · 3 comments
Labels

Comments

@mik1234mc
Copy link

Hi all,

encountered weird behavior for parameter defined as CFG_INT. If I set to a value =>0x80000000 on 32bit system. Libconfuse (3.3) gives me conf.conf:17: integer value for option 'parameter' is out of range. What I am doing wrong that integer value is not valid?

Thanks,
Mike

@troglobit
Copy link
Collaborator

CFG_INT is a signed integer. On a 32-bit system that means the maximum value is 0x7fffffff (2147483647).

See #11 for more information.

@mik1234mc
Copy link
Author

thank you for your answer. So, it turns out to be hex radix error; if I set -2147483648, it gives me 0x80000000. 0x80000000 is valid signed 32bit integer.

@troglobit
Copy link
Collaborator

Yeah, we use strtol() to convert the input value. The syntax 0nnnnn, 0xnnnn, 0bnnnn, or nnnn is only syntactic sugar to establish the radix argument to that function. when you input 0x80000000 try to convert a postive hexadecimal value that is greater than the datatype can store. The value 0x7fffffff is the largest positive value you can store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants