Closed badlogic closed 2 months ago
Whoops interesting, do you get a compile error with that (if yes, with which compiler / build settings)? Even though it's an oversight, AFAIK it's valid C/C++,
For instance the sokol_gfx.h C++ wrappers also return void:
...merged, thanks!
Would still be good to know why that exactly caused the trouble on your end.
Returning a value from a void function makes the compiler sad. See also the "missing" return statements for the other code paths in that function.
On Sun, Sep 15, 2024, 18:16 Andre Weissflog @.***> wrote:
...merged, thanks!
Would still be good to know why that caused trouble on your end.
— Reply to this email directly, view it on GitHub https://github.com/floooh/sokol/pull/1110#issuecomment-2351660884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5QBBFUDTSCPPDY7H7KL3ZWWXEBAVCNFSM6AAAAABOH4NDMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGY3DAOBYGQ . You are receiving this because you authored the thread.Message ID: @.***>
Apologies, only saw your last message due to email usage...
I have -Werror,-Wpedantic
on, which will complain, even if it's valid as per spec.
[build] sokol_audio.h:2476:9: error: void function '_saudio_backend_shutdown' should not return void expression [-Werror,-Wpedantic]
[build] return _saudio_coreaudio_backend_shutdown();
[build] ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xcode Clang, pretty recent iirc.
➜ clang --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.5.0
Thread model: posix
Ah ok. Building with -Wpedantic
is brave, I'm surprised that even works tbh ;)
I build the sokol test code with -Wall -Wextra -Werror -Wsign-conversion -Wstrict-prototypes
, but specifically left out -Wpedantic
(for GCC and Clang).
And for Windows: /W4 /WX /D_CRT_SECURE_NO_WARNINGS
.
I wonder now if returning void might be valid C++, but not valid C - would be another subtle difference ;)
Could be. My code base is C11, haven't tested with C++. Probably doesn't matter, because Sokol also supports MSVC :)
On Sun, Sep 15, 2024, 18:52 Andre Weissflog @.***> wrote:
I wonder now if returning void might be valid C++, but not valid C - would be another subtle difference ;)
— Reply to this email directly, view it on GitHub https://github.com/floooh/sokol/pull/1110#issuecomment-2351674044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5QBHNWV3MUVCN7MAODBLZWW3MBAVCNFSM6AAAAABOH4NDMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGY3TIMBUGQ . You are receiving this because you authored the thread.Message ID: @.***>
The code path tries to return void. Does not compile for obvious reasons.