[ ]>
__constant
__constant
2007-2011 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
3
__constant Address Space Qualifier.

##

__constant constant

## Description

&qualifierInc;

## Notes

The `__constant` or `constant` address space name is used to describe variables allocated in global memory and which are accessed inside a kernel(s) as read-only variables. These readonly variables can be accessed by all (global) work-items of the kernel during its execution. Pointers to the `__constant` address space are allowed as arguments to functions (including kernel functions) and for variables declared inside functions.

All string literal storage shall be in the `__constant` address space.

NOTE: Each argument to a kernel that is a pointer to the `__constant` address space is counted separately towards the maximum number of such arguments, defined as `CL_DEVICE_MAX_CONSTANT_ARGS` are described in the table for clGetDeviceInfo.

Variables in the program scope or the outermost scope of kernel functions can be declared in the `__constant` address space. These variables are required to be initialized and the values used to initialize these variables must be a compile time constant. Writing to such a variable results in a compile-time error.

Implementations are not required to aggregate these declarations into the fewest number of constant arguments. This behavior is implementation defined.

Thus portable code must conservatively assume that each variable declared inside a function or in program scope allocated in the `__constant` address space counts as a separate constant argument.

## Example

&qualifierExampleInc;

## Specification

OpenCL Specification

## Also see

__global, __local, __private

##