<div dir="ltr"><div dir="ltr">This example is a bit more representative of how we would use this to implement the MPI bindings (renamed "bar" macro to "foo" and shifted down to enable the name aliasing):<div><br></div><div>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(94,220,255);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">#include </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)"><stdio.h></span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p3" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(126,255,165);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">static</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">void</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> foo(</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">int</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> j) {</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>printf(</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">"foo(j) = </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(254,212,213)">%d\n</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">"</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">, j);</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(94,220,255);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">#define foo(j) foo(</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">sizeof</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">(j) > </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">sizeof</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">(</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">) ? -</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">1</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> : j)</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> main(</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> argc, </span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">char</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> *argv[]) {</span></p>
<p class="gmail-p5" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(44,238,235);background-color:rgb(0,0,0)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"><span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">/* 8589934592LL == 2^33 */</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">long</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">long</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> i = </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">8589934592LL</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> + </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">11</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">;</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>foo(i);</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">return</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">0</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">;</span></p>
<p class="gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">foo(j) = -1</span></p></div><div dir="ltr" class="gmail_attr"><br></div><div class="gmail_attr"> ~Jim.</div><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 4:16 PM Jim Dinan <<a href="mailto:james.dinan@gmail.com">james.dinan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Jeff,</div><div><br></div><div>You can wrap the function in a macro that checks for truncation:</div><div><br></div><div>
<p class="gmail-m_3194574109918675577gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(94,220,255);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">#include </span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)"><stdio.h></span></p>
<p class="gmail-m_3194574109918675577gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-m_3194574109918675577gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(94,220,255);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">#define bar(j) foo(</span><span class="gmail-m_3194574109918675577gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">sizeof</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">(j) > </span><span class="gmail-m_3194574109918675577gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">sizeof</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">(</span><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">) ? -</span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">1</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> : j)</span></p>
<p class="gmail-m_3194574109918675577gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-m_3194574109918675577gmail-p3" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(126,255,165);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">static</span><span class="gmail-m_3194574109918675577gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> </span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">void</span><span class="gmail-m_3194574109918675577gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> foo(</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">int</span><span class="gmail-m_3194574109918675577gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"> j) {</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span>printf(</span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">"foo(j) = </span><span class="gmail-m_3194574109918675577gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(254,212,213)">%d\n</span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">"</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">, j);</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p>
<p class="gmail-m_3194574109918675577gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0);min-height:16px"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> main(</span><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">int</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> argc, </span><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">char</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> *argv[]) {</span></p>
<p class="gmail-m_3194574109918675577gmail-p5" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(44,238,235);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(242,242,242)"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span></span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">/* 8589934592LL == 2^33 */</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span></span><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">long</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-m_3194574109918675577gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(126,255,165)">long</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> i = </span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">8589934592LL</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> + </span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">11</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">;</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span>foo(i);</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span>bar(i);</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_3194574109918675577gmail-Apple-converted-space"> </span></span><span class="gmail-m_3194574109918675577gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(232,235,20)">return</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span class="gmail-m_3194574109918675577gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(251,0,255)">0</span><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">;</span></p>
<p class="gmail-m_3194574109918675577gmail-p4" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p></div><div><br></div>
<p class="gmail-m_3194574109918675577gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">foo(j) = 11</span></p>
<p class="gmail-m_3194574109918675577gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:"Menlo for Powerline";color:rgb(242,242,242);background-color:rgb(0,0,0)"><span class="gmail-m_3194574109918675577gmail-s1" style="font-variant-ligatures:no-common-ligatures">foo(j) = -1</span></p><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div class="gmail_attr"> ~Jim.</div><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 9:59 AM Jeff Squyres (jsquyres) via mpi-forum <<a href="mailto:mpi-forum@lists.mpi-forum.org" target="_blank">mpi-forum@lists.mpi-forum.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">SHORT VERSION<br>
=============<br>
<br>
Due to the possibility of silently introducing errors into user applications, the BigCount WG no longer thinks that C11 _Generic is a good idea. We are therefore dropping that from our proposal. The new proposal will therefore essentially just be the addition of a bunch of MPI_Count-enabled "_x" functions in C, combined with the addition of a bunch of polymorphic MPI_Count-enabled interfaces in Fortran.<br>
<br>
MORE DETAIL<br>
===========<br>
<br>
Joseph Schuchart raised a very important point in a recent mailing thread: the following C/C++ code does not raise a compiler warning:<br>
<br>
-----<br>
#include <stdio.h><br>
<br>
static void foo(int j) {<br>
printf("foo(j) = %d\n", j);<br>
}<br>
<br>
int main(int argc, char *argv[]) {<br>
/* 8589934592LL == 2^33 */<br>
long long i = 8589934592LL + 11;<br>
foo(i);<br>
return 0;<br>
}<br>
-----<br>
<br>
If you compile and run this program on a commodity x86-64 platform, a) you won't get a warning from the compiler, and b) you'll see "11" printed out. I tried with gcc 9 and clang 8 -- both with the C and C++ compilers. I even tried with "-Wall -pedantic". No warnings.<br>
<br>
This is because casting from a larger int type to a smaller int type is perfectly valid C/C++.<br>
<br>
Because of this, there is a possibility that we could be silently introducing errors into user applications. Consider:<br>
<br>
1. An application upgrades its "count" parameters to type MPI_Count for all calls to MPI_Send.<br>
--> Recall that "MPI_Count" already exists in MPI-3.1, and is likely of type (long long) on commodity x86-64 platforms<br>
2. The application then uses values in that "count" parameter that are greater than 2^32.<br>
<br>
If the user's MPI implementation and compiler both support C11 _Generic, everything is great.<br>
<br>
But if either the MPI implementation or the compiler do not support C11 _Generic, ***the "count" value will be silently truncated at run time***.<br>
<br>
This seems like a very bad idea, from a design standpoint.<br>
<br>
We have therefore come full circle: we are back to adding a bunch of "_x" functions for C, and there will be no polymorphism (in C). Sorry, folks.<br>
<br>
Note that Fortran does not have similar problems:<br>
<br>
1. Fortran compilers have supported polymorphism for 20+ years<br>
2. Fortran does not automatically cast between INTEGER values of different sizes<br>
<br>
After much debate, the BigCount WG has decided that C11 _Generic just isn't worth it. That's no reason to penalize Fortran, though.<br>
<br>
-- <br>
Jeff Squyres<br>
<a href="mailto:jsquyres@cisco.com" target="_blank">jsquyres@cisco.com</a><br>
<br>
_______________________________________________<br>
mpi-forum mailing list<br>
<a href="mailto:mpi-forum@lists.mpi-forum.org" target="_blank">mpi-forum@lists.mpi-forum.org</a><br>
<a href="https://lists.mpi-forum.org/mailman/listinfo/mpi-forum" rel="noreferrer" target="_blank">https://lists.mpi-forum.org/mailman/listinfo/mpi-forum</a><br>
</blockquote></div></div>
</blockquote></div></div>