Repository navigation
fixed inconsistent return type - #4275
Conversation
error: inconsistent types 'bool' and 'int' deduced for lambda return type
|
Hi @battlecry231 |
| return true; | ||
| } | ||
| default: return 0; | ||
| default: return false; |
There was a problem hiding this comment.
@battlecry231 , this seem little weird as one would except that the compiler complains about the return false in the above case RS2_GL_EXTENSION_VIDEO_FRAME statement.
The default return (int) is actually consistent with the function's signature.
Can you post the Make error you see ?
There was a problem hiding this comment.
Here is the error when I try to compile with default: return 0;:
[ 54%] Building CXX object src/gl/CMakeFiles/realsense2-gl.dir/rs-gl.cpp.o
/home/***/Downloads/librealsense/src/gl/rs-gl.cpp: In lambda function:
/home/***/Downloads/librealsense/src/gl/rs-gl.cpp:117:21: error: inconsistent types ‘bool’ and ‘int’ deduced for lambda return type
default: return 0;
^
make[2]: *** [src/gl/CMakeFiles/realsense2-gl.dir/build.make:102: src/gl/CMakeFiles/realsense2-gl.dir/rs-gl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:407: src/gl/CMakeFiles/realsense2-gl.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Edit:
But you got a point there with the return type of the function. Though the conversion from bool to int is implicit it may be better to always return a real integer, hence changing every return false; to return 0; and the return true; in line 115 to return 1; in the function rs2_gl_is_frame_extendable_to.
Fixes the following error (GNU Make 4.2.1):
error: inconsistent types 'bool' and 'int' deduced for lambda return type