Error Propagation in OpenCL Specification

I’m new to OpenCL and have been reading the specs and examples supplied by NVIDIA’s OpenCL implementation. Is it just me or is error detail propagation a tad iffy? Some functions such as clCreateCommandQueue or clCreateBuffer return objects and require a pointer to an error code variable, whereas others such as clRetainCommandQueue or clGetPlatformInfo return an error state.

While I agree that both styles are perfectly valid and acceptable, would it not be more consistent to pick one and stick with it? Is there a particular reason the two styles were mixed that I’m not aware of? If this is an unintended oversight, now is probably the best time to fix the spec (while the standard is still young and implementations are few or incomplete). I have no preference of one style over the other, however I would appreciate more consistency.


The style the working group chose was to return the most important information as the return type. All functions that create an object (memory, command-queue etc.) return the object. Typically you check if the object value returned is NULL or not and then look at error code (or ignore it if you don’t need to).

Functions that operate on objects return an error.

Hope this helps clarify your question.

Indeed, that’s good enough for me.

Thanks very much affie.