<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 661</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="661"></A><H4>661.
  
Semantics of arithmetic comparisons
</H4>
<B>Section: </B>7.6.9&#160; [<A href="https://wg21.link/expr.rel">expr.rel</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD1
 &#160;&#160;&#160;

 <B>Submitter: </B>Daveed Vandevoorde
 &#160;&#160;&#160;

 <B>Date: </B>27 November 2007<BR>


<P>[Voted into the WP at the June, 2008 meeting.]</P>

<P>The actual semantics of arithmetic comparison &#8212; e.g.,
whether <TT>1 &lt; 2</TT> yields <TT>true</TT> or <TT>false</TT>
&#8212; appear not to be specified anywhere in the Standard.  The C
Standard has a general statement that</P>

<BLOCKQUOTE>

Each of the operators <TT>&lt;</TT> (less than), <TT>&gt;</TT>
(greater than), <TT>&lt;=</TT> (less than or equal to),
and <TT>&gt;=</TT> (greater than or equal to) shall yield 1 if the
specified relation is true and 0 if it is false.

</BLOCKQUOTE>

<P>There is no corresponding statement in the C++ Standard.</P>

<P><B>Proposed resolution (February, 2008):</B></P>

<OL>
<LI><P>Append the following paragraph to the end of
7.6.9 [<A href="https://wg21.link/expr.rel">expr.rel</A>]:</P></LI>

<BLOCKQUOTE>

If both operands (after conversions) are of arithmetic type, each of
the operators shall yield <TT>true</TT> if the specified relation is
true and <TT>false</TT> if it is false.

</BLOCKQUOTE>

<LI><P>Append the following paragraph to the end of
7.6.10 [<A href="https://wg21.link/expr.eq">expr.eq</A>]:</P></LI>

<BLOCKQUOTE>

Each of the operators shall yield <TT>true</TT> if the specified
relation is true and <TT>false</TT> if it is false.

</BLOCKQUOTE>

</OL>

<BR><BR>
</BODY>
</HTML>
