Describe the bug
When seekable_format is compiled with -DNDEBUG (common for release builds), the assert inside the switch is eliminated. As a result the "unreachable" code from lines 190 onwards become reachable and the compiler correctly determines that in line 193 the variable is used uninitialised triggering a warning. Since compiling with DNDEBUG is a valid way to reduce run-time overhead in release environments, I suggest this use-of-uninitialised-variable should be mitigated without the use of assert(), perhaps by return -1; in the default case below the assert(0);
To Reproduce
Steps to reproduce the behavior:
- Compile seekable_format with -DNDEBUG.
Expected behavior
No warnings are expected during compilation of seekable format or linking of a static library file resulting from such compilation.
Compilation environment:
- OS: Windows
- Version 1.5.7, also head of MAIN
- Compiler MSVC 19.29.30159.0
- Flags /W4 /O2 /DNDEBUG
- Build system CMake
Describe the bug
When seekable_format is compiled with -DNDEBUG (common for release builds), the assert inside the switch is eliminated. As a result the "unreachable" code from lines 190 onwards become reachable and the compiler correctly determines that in line 193 the variable is used uninitialised triggering a warning. Since compiling with DNDEBUG is a valid way to reduce run-time overhead in release environments, I suggest this use-of-uninitialised-variable should be mitigated without the use of assert(), perhaps by
return -1;in the default case below the assert(0);To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warnings are expected during compilation of seekable format or linking of a static library file resulting from such compilation.
Compilation environment: