Changeset 52eb7b7 for doc/theses


Ignore:
Timestamp:
Apr 9, 2025, 2:50:24 PM (5 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
50e8125
Parents:
2572add
Message:

fix editorial comment on Moss quote

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/fangren_yu_MMath/resolution.tex

    r2572add r52eb7b7  
    369369In C semantics, this example is unambiguously upcasting 32 to @unsigned long long@, performing the shift, then downcasting the result to @unsigned@, at cost (1, 0, 3, 1, 0, 0, 0).
    370370If ascription were allowed to be a first-class interpretation of a cast expression, it would be cheaper to select the @unsigned@ interpretation of @?>>?@ by downcasting @x@ to @unsigned@ and upcasting 32 to @unsigned@, at a total cost of (1, 0, 1, 1, 0, 0, 0).
    371 \PAB{[Note, this alternate interpretation is semantically incorrect, because the downcasting \lstinline{x} to from \lstinline{long long} to \lstinline{unsigned} is unsafe (truncation).]}
     371[Ed., both approached have an unsafe cast from \lstinline{long long} to \lstinline{unsigned} (truncation), the difference is when the truncation occurs, \ie before or after the shift, potentially generating different results.]
    372372However, this break from C semantics is not backwards compatible, so to maintain C compatibility, the \CFA resolver selects the lowest-cost interpretation of the cast argument for which a conversion or coercion to the target type exists (upcasting to @unsigned long long@ in the example above, due to the lack of unsafe downcasts), using the cost of the conversion itself only as a tie-breaker.~\cite[pp.~46-47]{Moss19}
    373373\end{cquote}
Note: See TracChangeset for help on using the changeset viewer.