Changeset 50e8125 for doc/theses


Ignore:
Timestamp:
Apr 9, 2025, 6:38:09 PM (5 months ago)
Author:
Fangren Yu <f37yu@…>
Branches:
master
Children:
119889f, d914750
Parents:
51b72bf5 (diff), 52eb7b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r51b72bf5 r50e8125  
    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.