6 lines
2.4 KiB
XML
6 lines
2.4 KiB
XML
|
<?xml version="1.0"?>
|
||
|
<clause number="14.4.2.3" title="Better conversion">
|
||
|
<paragraph>Given an implicit conversion C1 that converts from a type S to a type T1, and an implicit conversion C2 that converts from a type S to a type T2, the better conversion of the two conversions is determined as follows: <list><list_item> If T1 and T2 are the same type, neither conversion is better. </list_item><list_item> If S is T1, C1 is the better conversion. </list_item><list_item> If S is T2, C2 is the better conversion. </list_item><list_item> If an implicit conversion from T1 to T2 exists, and no implicit conversion from T2 to T1 exists, C1 is the better conversion. </list_item><list_item> If an implicit conversion from T2 to T1 exists, and no implicit conversion from T1 to T2 exists, C2 is the better conversion. </list_item><list_item> If T1 is <keyword>sbyte</keyword> and T2 is <keyword>byte</keyword>, <keyword>ushort</keyword>, <keyword>uint</keyword>, or <keyword>ulong</keyword>, C1 is the better conversion. </list_item><list_item> If T2 is <keyword>sbyte</keyword> and T1 is <keyword>byte</keyword>, <keyword>ushort</keyword>, <keyword>uint</keyword>, or <keyword>ulong</keyword>, C2 is the better conversion. </list_item><list_item> If T1 is <keyword>short</keyword> and T2 is <keyword>ushort</keyword>, <keyword>uint</keyword>, or <keyword>ulong</keyword>, C1 is the better conversion. </list_item><list_item> If T2 is <keyword>short</keyword> and T1 is <keyword>ushort</keyword>, <keyword>uint</keyword>, or <keyword>ulong</keyword>, C2 is the better conversion. </list_item><list_item> If T1 is <keyword>int</keyword> and T2 is <keyword>uint</keyword>, or <keyword>ulong</keyword>, C1 is the better conversion. </list_item><list_item> If T2 is <keyword>int</keyword> and T1 is <keyword>uint</keyword>, or <keyword>ulong</keyword>, C2 is the better conversion. </list_item><list_item> If T1 is <keyword>long</keyword> and T2 is <keyword>ulong</keyword>, C1 is the better conversion. </list_item><list_item> If T2 is <keyword>long</keyword> and T1 is <keyword>ulong</keyword>, C2 is the better conversion. </list_item><list_item> Otherwise, neither conversion is better. </list_item></list></paragraph>
|
||
|
<paragraph>If an implicit conversion C1 is defined by these rules to be a better conversion than an implicit conversion C2, then it is also the case that C2 is a worse conversion than C1. </paragraph>
|
||
|
</clause>
|