concept memory in category opencl

This is an excerpt from Manning's book OpenCL in Action: How to Accelerate Graphics and Computation.
In code, working with platforms is a two-step process. First you need to allocate memory for one or more cl_platform_id structures. Then you need to call clGetPlatformIDs to initialize these structures. This is usually one of the first functions you’ll call in your OpenCL code. Its signature, consisting of its function name and parameter list, is given as follows:
cl_int clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)There are three points to note about this function. First, despite the name, this function doesn’t return cl_platform_id structures. Instead, it places cl_platform_id structures in the memory referenced by platforms. It places the number of available platforms in the memory referenced by num_platforms. The return value is an integer that identifies whether the function successfully detected one or more platforms. A value of 0 indicates success. A negative value indicates failure.
A second difference between the map/unmap functions and the read/write functions is the map_flags argument used in clEnqueueMapBuffer and clEnqueueMapImage. This configures the accessibility of the mapped memory on the host. If map_flags is set to CL_MAP_READ, the mapped memory will be read-only. If the flag is set to CL_MAP_WRITE, the mapped memory will be write-only. If CL_MAP_READ|CL_MAP_WRITE is used, the memory will be readable and writeable.
Let’s say you want to create a buffer object to hold a kernel’s output data. It’s a good idea to make the buffer object write-only so that the device can only write to it. You can do this by setting the CL_MEM_WRITE_ONLY flag in clCreateBuffer. For write-only buffers, the device allocates memory but the host doesn’t. Therefore, you can set the host pointer parameter in clCreateBuffer to NULL.