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

Fix for compiler warning in LTC681x.cpp #35

Open
gudnimg opened this issue Feb 8, 2020 · 2 comments · May be fixed by #38
Open

Fix for compiler warning in LTC681x.cpp #35

gudnimg opened this issue Feb 8, 2020 · 2 comments · May be fixed by #38

Comments

@gudnimg
Copy link

gudnimg commented Feb 8, 2020

In line 665 in LTC681x.cpp this line gives a compiler warning for undefined behaviour:

parsed_stat = data[data_counter++] + (data[data_counter++]<<8);

Changing this to:

parsed_stat = data[data_counter] + (data[data_counter+ 1]<<8);
data_counter = data_counter + 2;

resolves the warning.

gudnimg added a commit to gudnimg/Linduino that referenced this issue Mar 17, 2020
@gudnimg gudnimg linked a pull request Mar 17, 2020 that will close this issue
@jothishjoseph
Copy link
Contributor

Hope it is tested and working fine, approving the change

@gudnimg
Copy link
Author

gudnimg commented Mar 24, 2020

Just to make things more clear, this is what the compiler warning looks like on my end using the library before this commit.
image
I basically copied the code in the if statement above which does the same thing but without any warnings from the compiler.

image

The if (reg == 2) statement is where I am suggesting changes.

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

Successfully merging a pull request may close this issue.

2 participants