<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 12/17/2014 6:33 PM, Colin Riddell
wrote:<br>
</div>
<blockquote class=" cite" id="mid_54917F15_709_codeplay_com"
cite="mid:54917F15.709@codeplay.com" type="cite"><br>
I have went through the examples you provided and marked which
rules I disagree/am unsure about
<br>
<blockquote class=" cite" id="Cite_2935609" type="cite">Some
notable examples:
<br>
<br>
exp1 exp2 exp3 result eval reason
<br>
--------+-------+--------+--------+--------+--------
<br>
char2 int int error - 7.1
<br>
</blockquote>
Can you remind me where the wording about number of bits matching
is.... I am not sure about this one because 220 also states that
" The second and third expressions can be any type, as long their
types match". Which to me, suggests that the char2 ? int : int
example is allowed. Also in table 6.14, for select() in c ? b :
a a and b need to have matching types, but c can be different
as long as its integer
<br>
</blockquote>
<br>
Page 220 also states that if the condition is a vector, then the
operator is equivalent to calling the select builtin. The select
builtin in table 6.14 says that c must have the same number of
elements and *bits* as the other two.<br>
<br>
<blockquote class=" cite" id="mid_54917F15_709_codeplay_com"
cite="mid:54917F15.709@codeplay.com" type="cite">
<blockquote class=" cite" id="Cite_5973160" type="cite">
char2 int2 int2 error - 4.1
<br>
</blockquote>
Same logic applies for this.
<br>
<blockquote class=" cite" id="Cite_8449770" type="cite">
int2 char char error - 7.1
<br>
</blockquote>
And this.
<br>
<blockquote class=" cite" id="Cite_7817607" type="cite">
int2 int2 float2 error - 5
<br>
</blockquote>
Agree it should error, but because no implicit conversion is
allowed between int2 and float2
<br>
</blockquote>
<br>
Yup. The "5" here refers to point 5, which in turn specifies that
"usual arithmetic conversions" (Section 6.2.6) are used. The same
section says that no implicit conversion is allowed. So we are both
saying the same thing.<br>
<br>
<blockquote class=" cite" id="mid_54917F15_709_codeplay_com"
cite="mid:54917F15.709@codeplay.com" type="cite">
<blockquote class=" cite" id="Cite_9931166" type="cite">
int2 int2 float error - 5
<br>
</blockquote>
Not sure about this one, my understanding here is that an attempt
will be made at converting the float to a vec2. Maybe I
misunderstand this rule?
<br>
</blockquote>
<br>
Section 6.2.6 states that the scalar cannot be of higher rank than
the vector when converting. Looking at it another way, if we managed
to convert the float to a float2, it cannot be implicitly converted
to int2 or vice versa. <br>
<br>
<blockquote class=" cite" id="mid_54917F15_709_codeplay_com"
cite="mid:54917F15.709@codeplay.com" type="cite">
<blockquote class=" cite" id="Cite_424605" type="cite">
int2 char2 char2 error - 4.1
<br>
</blockquote>
Same as my first point
<br>
</blockquote>
<br>
And same explanation applies. The difference between 4.1 and 7.1 is
that in 4.1, the result type is already a vector type and the rules
of the select builtin apply right away. But in 7.1, the result type
is a scalar type, and this is probably undefined behaviour. We are
choosing to define it as if the scalar was turned into a vector
without changing its element type, which is not covered by any
conversion rule.<br>
<br>
Sameer.<br>
<br>
</body>
</html>