Skip to content

Commit d353c7c

Browse files
[C++ for OpenCL] Misc formattings/clarifications (#516)
Improved section on address spaces: - Fixed formatting of spec ref - Add minor clarifications Co-authored-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
1 parent 603ec1e commit d353c7c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

cxx4opencl/address_spaces.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
This section only documents behavior related to {cpp} features. For example
1111
conversion rules are extended from the qualification conversion {cpp}17
12-
[conv.qual] but the compatibility is determined using notation of sets and
12+
`[conv.qual]` but the compatibility is determined using notation of sets and
1313
overlapping of address spaces from Embedded C
1414
(`ISO/IEC JTC1 SC22 WG14 N1021 s3.1.3`). For OpenCL it means that implicit
1515
conversions are allowed from a named address space (except for `+__constant+`)
@@ -20,13 +20,13 @@ space exists. Most of the rules follow this logic.
2020

2121
==== Casts
2222

23-
C-style casts follow rules of `OpenCL C v2.0 s6.5.5`. Conversions to generic
24-
address space can be made by any {cpp} cast operator (as an implicit
25-
conversion); converting from generic to named address space can only be done
26-
using the dedicated `addrspace_cast` operator. Operator `addrspace_cast` can only
27-
convert between address spaces and no other conversions are allowed to occur.
28-
Note that conversions between `__constant` and any other other address space
29-
are disallowed.
23+
C-style casts follow rules of `OpenCL C v2.0 s6.5.5`. Conversions of
24+
pointers and references to the generic address space can be done by any {cpp} cast
25+
operator (as an implicit conversion); converting from generic to named address
26+
space can only be done using the dedicated `addrspace_cast` operator. The
27+
`addrspace_cast` operator can only convert between address spaces for pointers and references
28+
and no other conversions are allowed to occur. Note that conversions between
29+
`__constant` and any other other address space are disallowed.
3030

3131
[source,cpp]
3232
----------
@@ -88,7 +88,7 @@ Address spaces are not deduced for:
8888
specializations or non-type type based template parameters.
8989
* non-pointer/non-reference class members except for static data members
9090
that are deduced to `+__global+` address space.
91-
* non-pointer/non-reference alias declarations.
91+
* non-pointer/non-reference type alias declarations.
9292
* decltype expressions.
9393

9494
[source,cpp]
@@ -152,7 +152,7 @@ __kernel void foo()
152152
// (addr space of a pointer is deduced regularly,
153153
// addr space of its pointee is taken from 'i').
154154

155-
auto *&refptr = ptr; // type of 'refptr' is '__local int * & __private'
155+
auto *&refptr = ptr; // type of 'refptr' is '__local int * generic & __private'
156156
// (addr space of a reference and type of referencing object
157157
// is deduced regularly,
158158
// addr space of a pointee is taken from the pointee of 'ptr').

0 commit comments

Comments
 (0)