jvoermans / Vibration_Logger

Logger to measure sea ice vibrations
3 stars 1 forks source link

Uninitialised global static variable #2

Closed jerabaul29 closed 3 years ago

jerabaul29 commented 3 years ago

@jvoermans this:

https://github.com/jvoermans/Vibration_Logger/blob/21e87633c37d1f2c56b8dec5904816fefdc27bd6/LowLatencyLogger_Joey_v5/UserFunctions.cpp#L5

Is quite dangerous, you should initialize to 0, otherwise the value you get is undefined behaviour, see:

https://en.cppreference.com/book/uninitialized#:~:text=The%20value%20in%20an%20uninitialized,before%20you%20can%20use%20it.

jvoermans commented 3 years ago

Ok, I have to look into that cause I'm not sure what this means...

jerabaul29 commented 3 years ago

I do not think this is causing problem, but good to fix.