Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Value never used #149

Closed
rubienr opened this issue Nov 16, 2020 · 3 comments · Fixed by #155
Closed

Value never used #149

rubienr opened this issue Nov 16, 2020 · 3 comments · Fixed by #155
Labels
fixed Issue is fixed

Comments

@rubienr
Copy link

rubienr commented Nov 16, 2020

Vale is never used:

Suggested fix:

  //payloadCfg is now loaded with current bytes. Get what we need
  uint16_t measurementRate {extractInt(0)}; //Pull from payloadCfg at measRate LSB

  measurementRate = 1000 / measurementRate; //This may return an int when it's a float, but I'd rather not return 4 bytes
  return (measurementRate);
}
@PaulZC
Copy link
Collaborator

PaulZC commented Nov 17, 2020

Hi @rubienr ,
I think the original code is OK? It creates measurementRate, sets it to zero and then loads it with the 0'th byte of payloadCfg using extractInt.
Please check.
Best wishes,
Paul

@rubienr
Copy link
Author

rubienr commented Nov 17, 2020

The code is okay. Clang claims that the initialization value 0 is never used but then is overwritten in L 2316 with assignment of extractInt(0). The measurementRate initialization could go from L 2313 to L 2316 as uint16_t measurementRate {extractInt(0)}; and clang would be happy again. I don't want to be picky, but I would like to compile with -Wall -Werror :)

@PaulZC
Copy link
Collaborator

PaulZC commented Nov 18, 2020

Hi @rubienr ,
OK. However I fear that life is really much too short to make every piece of code 100% clang-compatible! Especially retrospectively...
Let me know if this commit fixes it.
Best wishes,
Paul

@PaulZC PaulZC added the fixed Issue is fixed label Nov 30, 2020
@PaulZC PaulZC linked a pull request Dec 1, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed Issue is fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants