finitespace / BME280

Provides an Arduino library for reading and interpreting Bosch BME280 data over I2C, SPI or Sw SPI.
GNU General Public License v3.0
212 stars 105 forks source link

Add missing return statements. #92

Closed bertrik closed 3 years ago

bertrik commented 6 years ago

Related issue # and issue behavior

This fixes the compile warnings I get when using this library in my project. The warnings are about two functions declared in the header file as returning a bool, but the actual implementation does not actually return a bool, returning a void instead.

Description of changes/fixes

This patch adds the return statements (true) to the two functions that are missing them.

EmbeddedG commented 4 years ago

With GCC 8.3, these are more serious problem and cause strange errors. A missing return in a function returning non-void is undefined behaviour in C++, and GCC 8.3 for Cortex-M0 generates code where these functions don't return and the execution just flows to the next address in program memory causing very strange and hard to debug errors.

finitespace commented 3 years ago

Nice catch. However, I think the correct solution is to change the function signatures return to void.

finitespace commented 3 years ago

121