diff options
author | Chris Robinson <[email protected]> | 2023-05-22 02:25:30 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-22 02:25:30 -0700 |
commit | eca86489e422f00d96ce59a5c53fa45bdcea593e (patch) | |
tree | 023fafac55d3dc6888021fccf444f0e0990f3b83 /examples/alstreamcb.cpp | |
parent | 586b725cc37345601f01473dcc622241ee80d174 (diff) |
Make the API functions noexcept
Only relevant for C++, but these functions can't throw as it's a C-based API.
Letting the compiler know that helps improve code generation. Extension
callbacks must also not let exceptions leave the callback, or else Bad Things
can happen.
The macro AL_DISABLE_NOEXCEPT may be defined before including the headers to
not mark functions as noexcept, but this should only be done if the caller
can't otherwise be fixed.
Diffstat (limited to 'examples/alstreamcb.cpp')
-rw-r--r-- | examples/alstreamcb.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/alstreamcb.cpp b/examples/alstreamcb.cpp index a2e7b659..6cc24034 100644 --- a/examples/alstreamcb.cpp +++ b/examples/alstreamcb.cpp @@ -276,9 +276,9 @@ struct StreamPlayer { * but it allows the callback implementation to have a nice 'this' pointer * with normal member access. */ - static ALsizei AL_APIENTRY bufferCallbackC(void *userptr, void *data, ALsizei size) + static ALsizei AL_APIENTRY bufferCallbackC(void *userptr, void *data, ALsizei size) noexcept { return static_cast<StreamPlayer*>(userptr)->bufferCallback(data, size); } - ALsizei bufferCallback(void *data, ALsizei size) + ALsizei bufferCallback(void *data, ALsizei size) noexcept { /* NOTE: The callback *MUST* be real-time safe! That means no blocking, * no allocations or deallocations, no I/O, no page faults, or calls to |