You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C23 and C++17 support [[nodiscard]] on types and functions. As a tangent of #115 (comment) we decided we would like to use this. I think we would check the language version and turn this on if supported. Then it would produce warnings on discards if compiling with a supported language version.
WGPUStatus: Tentatively yes
Other returned enum types? Or just the functions they're returned from?
WGPUSurfaceTexture? Or just GetCurrentTexture?
All of the handles (like WGPUTexture)? Or only put it on create methods and any other functions that return owning refs (because they will leak)?
The text was updated successfully, but these errors were encountered:
FWIW I've added some time ago a couple of [[nodiscard]] attributes in my webgpu.hpp generator in the case of callback handles (unique_ptr to the callback pointer + its closure data that must not be freed before the callback gets invoked). IDK if there is a similar case in one of the WGPUFuture flavors, but might be worth considering it.
Also, I had to deal with a pretty boring MSVC issue when trying to detect the version of C++ (see the #define workaround, also note how C++20 enables custom nodiscard warning messages).
Other question: should we leave a #define-based way to disable these [[nodiscard]] (like defining WEBGPU_ALLOW_DISCARD before #include <webgpu/webgpu.h> for instance)? Or is this too much of a hack? I do not really care personnally though, let's not invent problems that nobody has.
C23 and C++17 support
[[nodiscard]]
on types and functions. As a tangent of #115 (comment) we decided we would like to use this. I think we would check the language version and turn this on if supported. Then it would produce warnings on discards if compiling with a supported language version.WGPUStatus
: Tentatively yesWGPUSurfaceTexture
? Or justGetCurrentTexture
?WGPUTexture
)? Or only put it on create methods and any other functions that return owning refs (because they will leak)?The text was updated successfully, but these errors were encountered: