<div class="__aliyun_email_body_block"><div  style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun"><div  style="clear: both;"><span  style="font-family: Tahoma, Arial, STHeiti, SimSun;">&gt; Is there some way in MSVC to ask for C and not C++?</span></div><div  style="clear: both;"><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">see&nbsp;<span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><a  href="https://learn.microsoft.com/en-us/cpp/build/reference/tc-tp-tc-tp-specify-source-file-type?view=msvc-170" target="_blank">https://learn.microsoft.com/en-us/cpp/build/reference/tc-tp-tc-tp-specify-source-file-type?view=msvc-170</a></span></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Because I'm not invoking MSVC directly via command line, I didn't get it work with xmake. And I tried to rename s7.c to s7.cpp, and found the C source code in s7.c will produce error when it is regarded as C++.</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; font-size: 18px; display: inline !important;">## My final solution is:</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><br ></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;">Patch s7.h in this way:</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; clear: both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">#if (__TINYC__ || (__clang__ &amp;&amp; __cplusplus) || _MSC_V)</span><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; typedef double s7_complex;</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">#else</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; #if (__cplusplus || _MSC_VER)</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; &nbsp; #include &lt;complex&gt;</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; &nbsp; typedef std::complex&lt;s7_double&gt; s7_complex;</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; #else</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; &nbsp; #include &lt;complex.h&gt;</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; &nbsp; typedef double complex s7_complex;</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; clear: both;">&nbsp; #endif</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">#endif</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">Just use double for s7_complex and define&nbsp;<span  class="pl-s" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">HAVE_COMPLEX_NUMBERS=0.</span></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 20px;">## What I have tried:</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">And I tried to solve the problem of `<span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; color: rgb(0, 0, 0); font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">typedef double complex s7_complex;</span>` by replacing it with `typedef _Dcomplex s7_complex` but failed.</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">see&nbsp;<span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><a  href="https://github.com/microsoft/STL/issues/3280" target="_blank">https://github.com/microsoft/STL/issues/3280</a></span></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">To include complex.h, one must guard it with&nbsp;<span  class="pl-token" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">_CRT_USE_C_COMPLEX_H, if one decide to make it work, one must solve the issues in s7.c like:</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  class="pl-token" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">1. define CMPLX for MSVC</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  class="pl-token" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">2. Solve the issues for futher incompatibility</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  class="pl-token" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><span  style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 20px;">## Suggested way to make it work</span></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">1. Assumming HAVE_COMPLEX_NUMBER=0 , when we are using a C compiler</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">2. Assumming HAVE_COMPLEX_NUMBER=1, when we are using a C++ compiler</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">For 1, because it is a nightmare to make the C code work for Windows and *nix.</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">For 2, because it is much easier to make the C++ code work for Windows and *nix.</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">And for 2, we might need to make sure that when we rename s7.c to s7.cpp, it should compile in MSVC.</div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;"><br ></div><div  style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">(sorry for sending this email twice, because for the first time, it was sent to Bill privately. To make it public, I'm sending it to the mail list this time)</div></div><div ></div><span  style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun;"><br ></span></div><blockquote  style="margin-right: 0px; margin-top: 0px; margin-bottom: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; color: rgb(0, 0, 0);"><div  style="clear: both;">------------------------------------------------------------------</div><div  style="clear: both;">From:bil &lt;bil@ccrma.Stanford.EDU&gt;</div><div  style="clear: both;">Send Time:2024 Nov. 19 (Tue.) 23:03</div><div  style="clear: both;">To:"沈达"&lt;da@liii.pro&gt;</div><div  style="clear: both;">Cc:cmdist&lt;cmdist@ccrma.Stanford.EDU&gt;</div><div  style="clear: both;">Subject:Re: [CM] s7_complex does not compile for MSVC</div><div  style="clear: both;"><br ></div>Thanks for the info about MSVC.&nbsp; I think I could get<br >further in clang++, assuming C++11, with<br ><br > &nbsp; &nbsp; using s7_complex = std::complex&lt;double&gt;;<br ><br >but there were still endless complaints (mostly about<br >missing casts).&nbsp; In clang++, the first warning is<br ><br >&nbsp; &nbsp; clang: warning: treating 'c' input as 'c++' when in C++ mode, this <br >behavior is deprecated<br ><br >which makes me think the C++ community has decided to<br >cut its ties to C.&nbsp; I'll go back and poke at this,<br >but it feels like a hopeless situation.&nbsp; Is there<br >some way in MSVC to ask for C and not C++?</blockquote></div></div>