<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 11 Aug 2020, at 8:15, Anastasia Stulova wrote:</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">> Alexey is correct that C and C++ require that if a variable x has type</p>
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto">T, the expression &x must have type T *. Anything else is not<br>
strictly conformant, whether it compiles or not.</p>
</blockquote><p dir="auto">Btw OpenCL doesn't violate these rules.</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">It does.  C requires the type of a variable to be exactly the type<br>
that it was written with, notwithstanding a handful of exceptions<br>
around e.g. parameters of array type or <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">int x[] = {1,2,3};</code>).<br>
In OpenCL, a local variable <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">int x;</code> has type <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">__private int</code>,<br>
and that is not conformant.  And there’s nothing wrong with that,<br>
because OpenCL is its own language and its programs do not need<br>
to conform to the C standard.</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Moreover, it uses conventional<br>
embedded C address space qualifier logic. It only defines a concrete<br>
memory hierarchy and adds an inference logic for address spaces that is<br>
not present in an embedded C extension.</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">Inferring non-generic address spaces for variables is not conformant<br>
to the Embedded C specification.  The mechanics of address spaces in<br>
OpenCL otherwise conform to the Embedded C specification, but<br>
Embedded C does not change the rules for how unqualified types work.<br>
Unlike OpenCL, Embedded C is a pure language extension: programs<br>
that do not use the extension’s features behave exactly as specified<br>
by the C standard.  Only when an address space is actually uttered<br>
do those rules have any effect.</p>

<p dir="auto">John.</p>
</div>
</div>
</body>
</html>