Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utility function to map error codes to a string #4

Open
kpet opened this issue Jan 10, 2020 · 2 comments
Open

Utility function to map error codes to a string #4

kpet opened this issue Jan 10, 2020 · 2 comments

Comments

@kpet
Copy link
Contributor

kpet commented Jan 10, 2020

Many projects are rolling their own and most of them end up with missing error codes over time. Should we provide an official solution?

An example of the many such discussions I've been pointed to: https://stackoverflow.com/questions/24326432/convenient-way-to-show-opencl-error-codes#comment39780932_24336429

@Kerilk
Copy link
Collaborator

Kerilk commented Jan 10, 2020

I think it would be a very good idea. Maybe providing a function which could provide both (or either one) of the string representation of the symbol (CL_DEVICE_NOT_FOUND) and a more human readable message (OpenCL device was not found).

cl_int clGetErrorSymbolMessage(cl_int errcode, const char **errcode_symbol_ret, const char **errcode_message_ret);

Each pointer could be NULL to ignore the value. Or the function could be split in two.
We would need to add a new error code: CL_UNKNOWN_ERROR_CODE

@kpet kpet transferred this issue from KhronosGroup/OpenCL-Headers Jun 9, 2020
@MathiasMagnus
Copy link
Collaborator

As for bikeshedding, can we call it cl_strerror in C and cl::strerror in C++?

Actually it doesn't really matter what we call it, but the functionality should be there. Possible locale awareness is a bonus. I can translate to hu_HU. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants