| // Copyright 2021-2024 The Khronos Group. This work is licensed under a |
| // Creative Commons Attribution 4.0 International License; see |
| // http://creativecommons.org/licenses/by/4.0/ |
| |
| [[kernel_function]] |
| === Kernel functions |
| |
| Kernel functions have implicit C linkage ({cpp}17 `[dcl.link]`) which |
| means that {cpp} specific features are not supported. Therefore, the kernel |
| functions: |
| |
| * Can not be class members ({cpp}17 `[class.mfct]`); |
| * Can not be overloaded ({cpp}17 `[over]`); |
| * Can not be function templates ({cpp}17 `[temp.fct]`). |
| |
| :fn-ker-par-ref: footnote:[Whether C++ features (e.g references) can be used \ |
| in functions with C linkage is implementation-defined ({cpp}17 [dcl.link\]).] |
| |
| Moreover the types used in parameters of the kernel functions must be: |
| |
| * Trivial and standard-layout types {cpp}17 `[basic.types]` (plain old data |
| types) for parameters passed by value; |
| * Standard-layout types for pointer parameters. The same applies to |
| references{fn-ker-par-ref} if an implementation supports them in kernel |
| parameters. |
| |
| These are additional restrictions to the list detailed in `OpenCL C 3.0 s6.11`. |