Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3222,6 +3222,29 @@
\howwide
Rare.

\diffref{expr.rel,expr.eq}
\change
Relational and equality comparison expressions are of type \tcode{int} in C,
but of type \tcode{bool} in \Cpp{}.
\rationale
Increased type safety.
\effect
Change to semantics of well-defined feature.
C programs relying on a specific type will yield different results.
\begin{example}
\begin{codeblock}
auto t = (0 == 0); // of type \tcode{int} in C, of type \tcode{bool} in \Cpp{}
bool* b = &t; // valid \Cpp{}, constraint violation in C

int sum;
ckd_add(&sum, (0 < 0), 1); // valid C, ill-formed \Cpp{}\iref{numerics.c.ckdint}
\end{codeblock}
\end{example}
\difficulty
Programs must add explicit casts to the appropriate type.
\howwide
Rare.

\diffref{expr.cond,expr.assign,expr.comma}
\indextext{conversion!lvalue-to-rvalue}%
\indextext{rvalue!lvalue conversion to}%
Expand Down
Loading