<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>CodeProject Latest postings for C / C++ / MFC</title>
    <link>https://www.codeproject.com</link>
    <description>Latest postings for C / C++ / MFC from CodeProject</description>
    <language>en-us</language>
    <image>
      <title>CodeProject Latest postings for C / C++ / MFC</title>
      <url>https://www.codeproject.com/App_Themes/Std/Img/logo100x30.gif</url>
      <link>https://www.codeproject.com</link>
      <width>100</width>
      <height>30</height>
      <description>CodeProject</description>
    </image>
    <copyright>Copyright  CodeProject, 1999-2024</copyright>
    <webMaster>Webmaster@codeproject.com (Webmaster)</webMaster>
    <lastBuildDate>Tue, 23 Jul 2024 06:37:00 GMT</lastBuildDate>
    <ttl>20</ttl>
    <generator>C# Hand-coded goodness</generator>
    <item>
      <title>HOW TO ANSWER A QUESTION</title>
      <description>Apologies for the shouting but this is important.&lt;br /&gt;
&lt;br /&gt;
When answering a question please:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Read the question carefully&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Understand that English isn't everyone's first language so be lenient of bad spelling and grammar&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. &lt;b&gt;Insults are not welcome&lt;/b&gt;&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;If the question is inappropriate then click the 'vote to remove message' button&lt;br /&gt;
&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid. &lt;br /&gt;
&lt;br /&gt;
&lt;div class="ForumSig"&gt;cheers,&lt;br /&gt;
Chris Maunder&lt;br /&gt;
&lt;br /&gt;
The Code Project Co-founder&lt;br /&gt;
Microsoft C++ MVP&lt;/div&gt;</description>
      <author>Chris Maunder</author>
      <link>https://www.codeproject.com/Messages/3117206/HOW-TO-ANSWER-A-QUESTION</link>
      <pubDate>Mon, 13 Jul 2009 08:37:00 GMT</pubDate>
      <guid>3_3117206</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>HOW TO ASK A QUESTION</title>
      <description>For those new to message boards please try to follow a few simple rules when posting your question.&lt;ol&gt;&lt;li&gt;&lt;b&gt;Choose the correct forum for your message&lt;/b&gt;. Posting a VB.NET question in the C++ forum will end in tears.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;&lt;b&gt;Be specific!&lt;/b&gt; Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Keep the subject line brief, but descriptive. eg "File Serialization problem"&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;&lt;b&gt;Do not remove or empty a message&lt;/b&gt; if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;If you are posting source code with your question, place it inside &amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt; tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums. &lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;No advertising or soliciting.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;&lt;li&gt;We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.&lt;/li&gt;&lt;/ol&gt; &lt;br /&gt;
&lt;br /&gt;
cheers,&lt;br /&gt;
Chris Maunder&lt;br /&gt;
&lt;br /&gt;
The Code Project Co-founder&lt;br /&gt;
&lt;div class="SmallText"&gt;Microsoft C++ MVP&lt;/div&gt;</description>
      <author>Chris Maunder</author>
      <link>https://www.codeproject.com/Messages/2922875/HOW-TO-ASK-A-QUESTION</link>
      <pubDate>Fri, 13 Feb 2009 04:19:00 GMT</pubDate>
      <guid>3_2922875</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>C++20 UNORDERED_MAP OBJECT WITH CLASS FUNCTIONS FROM DLL AS VALUE</title>
      <description>&lt;div class='pre-lang' id='premain232228'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode232228' class='copy-code' data-index='232228' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre232228' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-digit"&gt;2&lt;/span&gt; Errors:
a) Lambda does not not with &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;var&lt;/span&gt;, so I must to work wwith bind
b) I &lt;span class="code-keyword"&gt;try&lt;/span&gt; to invoke functions of &lt;span class="code-keyword"&gt;class&lt;/span&gt; &lt;span class="code-sdkkeyword"&gt;from&lt;/span&gt; DLL, saved &lt;span class="code-keyword"&gt;in&lt;/span&gt; unordered_map &lt;span class="code-keyword"&gt;object&lt;/span&gt; and fall.If to invoke functions of &lt;span class="code-keyword"&gt;class&lt;/span&gt; not &lt;span class="code-sdkkeyword"&gt;from&lt;/span&gt; DLL it &lt;span class="code-keyword"&gt;is&lt;/span&gt; work properly.
&lt;b&gt;How can &lt;span class="code-keyword"&gt;this&lt;/span&gt; problem be solved?&lt;/b&gt;


	&lt;b&gt;file UnorderedMapFunctions.cpp&lt;/b&gt;
&amp;lt;pre lang=&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;C++"&lt;/span&gt;&amp;gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;unordered_map&amp;gt;
#include &amp;lt;functional&amp;gt;
#include &amp;lt;windows.h&amp;gt;

#include &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;..\\Geometry\\Geometry.h"&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; &lt;span class="code-keyword"&gt;namespace&lt;/span&gt; std;

&lt;span class="code-keyword"&gt;namespace&lt;/span&gt; NS
{
  &lt;span class="code-keyword"&gt;class&lt;/span&gt; Math
  {
  &lt;span class="code-keyword"&gt;public&lt;/span&gt;:
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Sum(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; x + y; }
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Sub(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; x - y; }
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Mul(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; x * y; }
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Div(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; x / y; }
  };
}
&lt;span class="code-keyword"&gt;using&lt;/span&gt; &lt;span class="code-keyword"&gt;namespace&lt;/span&gt; NS;

&lt;span class="code-keyword"&gt;int&lt;/span&gt; main()
{
  unordered_map&amp;lt;string, function&amp;lt;int(&lt;span class="code-keyword"&gt;int&lt;/span&gt;, &lt;span class="code-keyword"&gt;int&lt;/span&gt;)&amp;gt;&amp;gt;* mydata = &lt;span class="code-keyword"&gt;new&lt;/span&gt; unordered_map&amp;lt;string, function&amp;lt;int(&lt;span class="code-keyword"&gt;int&lt;/span&gt;, &lt;span class="code-keyword"&gt;int&lt;/span&gt;)&amp;gt;&amp;gt;;
  Math* m = &lt;span class="code-keyword"&gt;new&lt;/span&gt; Math;
 
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; Using lambda functions to bind member functions&lt;/span&gt;
  (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;sum"&lt;/span&gt;] = [m](&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; m-&amp;gt;Sum(x, y); };
  (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;sub"&lt;/span&gt;] = [m](&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; m-&amp;gt;Sub(x, y); };
  (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;mul"&lt;/span&gt;] = [m](&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; m-&amp;gt;Mul(x, y); };
  (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;div"&lt;/span&gt;] = [m](&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; m-&amp;gt;Div(x, y); };
  &lt;span class="code-comment"&gt;/*&lt;/span&gt;&lt;span class="code-comment"&gt;
  //Geometry* g = new Geometry;
  (*mydata)["circle"] = [g](int x, int y) { return g-&amp;gt;Circle(x, y); };
  (*mydata)["rectangle"] = [g](int x, int y) { return g-&amp;gt;Rectangle(x, y); };
  */&lt;/span&gt;
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;==============================================================&lt;/span&gt;
  &lt;span class="code-keyword"&gt;string&lt;/span&gt; fullname_dll = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Geometry"&lt;/span&gt;;
  HINSTANCE hInst = LoadLibraryA(fullname_dll.c_str());
  &lt;span class="code-keyword"&gt;if&lt;/span&gt; (hInst == nullptr)
  {
    cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Error: [FuncImport] wrong name "&lt;/span&gt; &amp;lt;&amp;lt; fullname_dll.c_str() &amp;lt;&amp;lt; endl;
    &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-keyword"&gt;false&lt;/span&gt;;
  }
  typedef &lt;span class="code-keyword"&gt;void&lt;/span&gt; (CALLBACK* CreateInstanceFunc)(unordered_map&amp;lt;string, function&amp;lt;int(&lt;span class="code-keyword"&gt;int&lt;/span&gt;, &lt;span class="code-keyword"&gt;int&lt;/span&gt;)&amp;gt;&amp;gt;* mydata);
  &lt;span class="code-keyword"&gt;string&lt;/span&gt; CreateFuncName = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;CreateInstance"&lt;/span&gt;; 
  CreateInstanceFunc CreateInstance = (CreateInstanceFunc)GetProcAddress(hInst, CreateFuncName.c_str()); 
  &lt;span class="code-keyword"&gt;if&lt;/span&gt; (CreateInstance == nullptr)
  {
    cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Error: wrong name "&lt;/span&gt; &amp;lt;&amp;lt; fullname_dll &amp;lt;&amp;lt; endl;
    FreeLibrary(hInst);
    &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-keyword"&gt;false&lt;/span&gt;;
  }
  CreateInstance(mydata);
  cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Imported "&lt;/span&gt; &amp;lt;&amp;lt; fullname_dll.c_str();
  FreeLibrary(hInst);
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;==============================================================&lt;/span&gt;
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; Invoke by &amp;#39;key&amp;#39; functions, saved in &amp;#39;mydata&amp;#39;&lt;/span&gt;
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; it is right! &lt;/span&gt;
  &lt;span class="code-keyword"&gt;for&lt;/span&gt; (&lt;span class="code-keyword"&gt;const&lt;/span&gt; auto&amp;amp; [k, v] : *mydata)
    std::cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Key: "&lt;/span&gt; &amp;lt;&amp;lt; k &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; Value: "&lt;/span&gt; &amp;lt;&amp;lt; v(&lt;span class="code-digit"&gt;3&lt;/span&gt;, &lt;span class="code-digit"&gt;5&lt;/span&gt;) &amp;lt;&amp;lt; std::endl;
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;===================================&lt;/span&gt;
  auto it = mydata-&amp;gt;find(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;circle"&lt;/span&gt;);
  &lt;span class="code-keyword"&gt;if&lt;/span&gt; (it != mydata-&amp;gt;end())
   &lt;b&gt;&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; Exception thrown: read access violation.&lt;/span&gt;
   &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; fault in functional.h line 920&lt;/span&gt;
   &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; it-&amp;gt;second.vfptr = addr(??? ??? ??? ??? ???)&lt;/b&gt;&lt;/span&gt;
    cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;\nKey: "&lt;/span&gt; &amp;lt;&amp;lt; it-&amp;gt;first &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; Value: "&lt;/span&gt; &amp;lt;&amp;lt; it-&amp;gt;second(&lt;span class="code-digit"&gt;4&lt;/span&gt;, &lt;span class="code-digit"&gt;2&lt;/span&gt;) &amp;lt;&amp;lt; std::endl;
  &lt;span class="code-keyword"&gt;else&lt;/span&gt;
    cout &amp;lt;&amp;lt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Error\n"&lt;/span&gt;;
  &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;===================================&lt;/span&gt;

  delete m;
  delete mydata;
  &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-digit"&gt;0&lt;/span&gt;;
}&lt;/pre&gt;//=============================================================&lt;br /&gt;
	 2 Dll files: Geometry.h, Geometry.cpp&lt;br /&gt;
	&lt;b&gt;file Geometry.h&lt;/b&gt;&lt;br /&gt;
&lt;div class='pre-lang' id='premain4143'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode4143' class='copy-code' data-index='4143' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre4143' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-preprocessor"&gt;#pragma once
&lt;/span&gt;&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-leadattribute"&gt;iostream&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-leadattribute"&gt;unordered_map&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-leadattribute"&gt;functional&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-leadattribute"&gt;windows.h&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;
&lt;span class="code-preprocessor"&gt;#ifdef GEOMETRY_EXPORTS
&lt;/span&gt;&lt;span class="code-preprocessor"&gt;#define GEOMETRY_API __declspec(dllexport)
&lt;/span&gt;&lt;span class="code-preprocessor"&gt;#else
&lt;/span&gt;&lt;span class="code-preprocessor"&gt;#define GEOMETRY_API __declspec(dllimport)
&lt;/span&gt;&lt;span class="code-preprocessor"&gt;#endif
&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; &lt;span class="code-keyword"&gt;namespace&lt;/span&gt; std;
&lt;span class="code-keyword"&gt;namespace&lt;/span&gt; NS
{
  &lt;span class="code-keyword"&gt;class&lt;/span&gt; GEOMETRY_API Geometry
  {
  public:
    Geometry();
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Circle(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y);
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; Rectangle(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y);
  };
  &lt;span class="code-keyword"&gt;extern&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;C"&lt;/span&gt; &lt;span class="code-keyword"&gt;void&lt;/span&gt;  GEOMETRY_API  CreateInstance(unordered_map&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;string, function&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;int&lt;/span&gt;(&lt;span class="code-keyword"&gt;int&lt;/span&gt;, &lt;span class="code-keyword"&gt;int&lt;/span&gt;)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;* mydata);
  &lt;span class="code-keyword"&gt;extern&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;C"&lt;/span&gt; &lt;span class="code-keyword"&gt;void&lt;/span&gt;  GEOMETRY_API  Cleanup();
}&lt;/pre&gt;&lt;br /&gt;
	&lt;b&gt;file Geometry.cpp&lt;/b&gt;&lt;br /&gt;
&lt;div class='pre-lang' id='premain1015'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode1015' class='copy-code' data-index='1015' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre1015' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;pch.h"&lt;/span&gt;
&lt;/span&gt;&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Geometry.h"&lt;/span&gt;
&lt;/span&gt;
&lt;span class="code-keyword"&gt;namespace&lt;/span&gt; NS
{
   Geometry* geometryInstance;
  &lt;span class="code-keyword"&gt;void&lt;/span&gt; CreateInstance(unordered_map&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;string, function&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;int&lt;/span&gt;(&lt;span class="code-keyword"&gt;int&lt;/span&gt;, &lt;span class="code-keyword"&gt;int&lt;/span&gt;)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;* mydata)
  {
    geometryInstance = &lt;span class="code-keyword"&gt;new&lt;/span&gt; Geometry;
    &lt;span class="code-comment"&gt;// Can&amp;#39;t capture a static variable in a lambda
&lt;/span&gt;    &lt;span class="code-comment"&gt;//(*mydata)["circle"] = [geometryInstance](int x, int y) { return geometryInstance-&amp;gt;Circle(x, y); };
&lt;/span&gt;    &lt;span class="code-comment"&gt;//(*mydata)["rectangle"] = [geometryInstance](int x, int y) { return geometryInstance-&amp;gt;Rectangle(x, y); };
&lt;/span&gt;
    (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;circle"&lt;/span&gt;] = bind(&amp;amp;Geometry::Circle, geometryInstance, placeholders::_1, placeholders::_2);
    (*mydata)[&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;rectangle"&lt;/span&gt;] = bind(&amp;amp;Geometry::Rectangle, geometryInstance, placeholders::_1, placeholders::_2);
  }
  Geometry::Geometry() {}
  &lt;span class="code-keyword"&gt;int&lt;/span&gt; Geometry::Circle(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-digit"&gt;3&lt;/span&gt;.&lt;span class="code-digit"&gt;14&lt;/span&gt; * x * x; }
  &lt;span class="code-keyword"&gt;int&lt;/span&gt; Geometry::Rectangle(&lt;span class="code-keyword"&gt;int&lt;/span&gt; x, &lt;span class="code-keyword"&gt;int&lt;/span&gt; y) { &lt;span class="code-keyword"&gt;return&lt;/span&gt; x * y; }
  &lt;span class="code-keyword"&gt;void&lt;/span&gt; Cleanup()
  {
        &lt;span class="code-keyword"&gt;delete&lt;/span&gt; geometryInstance;
        geometryInstance = &lt;span class="code-keyword"&gt;nullptr&lt;/span&gt;;
  }
}&lt;/pre&gt;</description>
      <author>Oscar Kogosov 2023</author>
      <link>https://www.codeproject.com/Messages/6011009/Cplusplus20-UNORDERED-MAP-OBJECT-WITH-CLASS-FUNCTI</link>
      <pubDate>Tue, 23 Jul 2024 06:37:00 GMT</pubDate>
      <guid>3_6011009</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>glReadPixels wrong values</title>
      <description>hi,&lt;br /&gt;
I am not sure what is missing.&lt;br /&gt;
I created 16 bit grayscale buffer and pass it to &lt;code&gt;glDrawPixels(..)&lt;/code&gt;, then in mouse function callback I try to read the first pixel with &lt;code&gt;glReadPixels(0,0,1,1,GL_LUMINANCE ,GL_UNSIGNED_SHORT,pixUnSigShort)&lt;/code&gt; and is wrong. Tried also GL_LUMINANCE16.</description>
      <author>etechX2</author>
      <link>https://www.codeproject.com/Messages/6010862/glReadPixels-wrong-values</link>
      <pubDate>Mon, 22 Jul 2024 02:30:00 GMT</pubDate>
      <guid>3_6010862</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>C program(homework)</title>
      <description>&lt;div class='pre-lang' id='premain349284'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode349284' class='copy-code' data-index='349284' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre349284' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
Prepare the following strings &lt;span class="code-keyword"&gt;in&lt;/span&gt; advance &lt;span class="code-keyword"&gt;as&lt;/span&gt; an array. Be sure to write everything &lt;span class="code-keyword"&gt;in&lt;/span&gt; full-width characters.
&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;The difference between being 18 and 81. 18 years old is the one who drowns in love, 81 years old is the one who drowns in the bath. 18 years old is the one who runs down the road, and vice versa.
The person running is 81 years old. An 18-year-old has a fragile heart, and an 81-year-old has a fragile bone. I&amp;#39;m 18 years old and my heart can&amp;#39;t stop pounding.
He is 81 years old and can&amp;#39;t stop the plane. An 18-year-old can choke on love, and an 81-year-old can choke on rice cakes. I&amp;#39;m concerned about the deviation value
I am 18 years old, and I am 81 years old and concerned about my blood pressure and blood sugar levels. An 18-year-old who doesn&amp;#39;t know anything yet, an 81-year-old who doesn&amp;#39;t remember anything anymore.
An 18-year-old who is looking for himself, and an 81-year-old who is looking for everyone else. "&lt;/span&gt;
- Then have the user enter a search &lt;span class="code-keyword"&gt;string&lt;/span&gt;. Search characters can be up to &lt;span class="code-digit"&gt;10&lt;/span&gt; characters.
・Then, have the user enter a replacement &lt;span class="code-keyword"&gt;string&lt;/span&gt;. Replacement characters can be up to &lt;span class="code-digit"&gt;10&lt;/span&gt; characters.
- Perform a prefix match search on the above &lt;span class="code-keyword"&gt;string&lt;/span&gt; and replace all hit strings.
- After replacing, output the result to the screen. If there are no conversion candidates, &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Nothing to convert"&lt;/span&gt; &lt;span class="code-keyword"&gt;is&lt;/span&gt; displayed.(&lt;span class="code-keyword"&gt;if&lt;/span&gt; the searched &lt;span class="code-keyword"&gt;string&lt;/span&gt; &lt;span class="code-keyword"&gt;is&lt;/span&gt; &lt;span class="code-keyword"&gt;in&lt;/span&gt; more than &lt;span class="code-digit"&gt;1&lt;/span&gt; place on the original &lt;span class="code-keyword"&gt;string&lt;/span&gt;, the replacement will replace all of it)

Community Verified icon&lt;/pre&gt;</description>
      <author>Member 16311074</author>
      <link>https://www.codeproject.com/Messages/6010481/C-program-homework</link>
      <pubDate>Fri, 19 Jul 2024 06:36:00 GMT</pubDate>
      <guid>3_6010481</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>How to use QUERY_CHANGES_VIRTUAL_DISK_RANGE when HyperV backup</title>
      <description>Does anyone know the use of &lt;big&gt;QueryChangesVirtualDisk&lt;/big&gt; ?&lt;br /&gt;
I have call the function successfully.&lt;br /&gt;
But how to use the &lt;big&gt;QUERY_CHANGES_VIRTUAL_DISK_RANGE&lt;/big&gt;?</description>
      <author>DingHuaming</author>
      <link>https://www.codeproject.com/Messages/6010294/How-to-use-QUERY-CHANGES-VIRTUAL-DISK-RANGE-when-H</link>
      <pubDate>Thu, 18 Jul 2024 04:39:00 GMT</pubDate>
      <guid>3_6010294</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>Code change request (From Linux To Windows)</title>
      <description>Dear somebody,&lt;br /&gt;
&lt;br /&gt;
I have in trouble with some code.&lt;br /&gt;
&lt;br /&gt;
Q1) ==&amp;gt; Actually my reqeust.  &lt;br /&gt;
I want to build this open source "https://github.com/ChengranAA/QuickNii" but something failed in &lt;br /&gt;
nifticlib and zlib. The owner maybe not familiar with Windows build.&lt;br /&gt;
So I've found new ones.&lt;br /&gt;
&lt;div class='pre-lang' id='premain967058'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode967058' class='copy-code' data-index='967058' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre967058' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
https:&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;github.com/NIFTI-Imaging/nifti_clib&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
For windows git bash method...&lt;br /&gt;
&lt;div class='pre-lang' id='premain985122'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode985122' class='copy-code' data-index='985122' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre985122' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
https:&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;github.com/addisonElliott/nifticlib&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
this man tells original Windows CMake method but...&lt;br /&gt;
I'm already exhausted in CMake gui use!!!!&lt;br /&gt;
&lt;br /&gt;
Is there anybody who can help EASY&amp;amp;Simple~~ Windows develop source code view????  &lt;img src="https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_frown.gif" align="top" alt="Frown | :(" /&gt; &lt;br /&gt;
I want to change it but...there some problems and not clean changed~&lt;br /&gt;
&lt;br /&gt;
For the &lt;br /&gt;
Q2) C# wpf code can wrap(import code) well the C++ codes in VS2022?? (Just for usual programming)&lt;br /&gt;
&lt;br /&gt;
If this question is stupid or something violated codeproject policy, I will delete it or I will &lt;br /&gt;
agree to automatically delete from codeproject admin.</description>
      <author>Member 16143694</author>
      <link>https://www.codeproject.com/Messages/6009840/Code-change-request-From-Linux-To-Windows</link>
      <pubDate>Mon, 15 Jul 2024 07:30:00 GMT</pubDate>
      <guid>3_6009840</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>C++ DLL Debugging - Visual Studio 2022</title>
      <description>&lt;div class='pre-lang' id='premain320667'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode320667' class='copy-code' data-index='320667' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre320667' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
Can someone please tell me how I can debug a C++ DLL &lt;span class="code-sdkkeyword"&gt;from&lt;/span&gt; within Tradestation &lt;span class="code-digit"&gt;10&lt;/span&gt; by attaching VS2022 to the Tradestation process?

I can compile a DLL successfully and call a function &lt;span class="code-sdkkeyword"&gt;from&lt;/span&gt; it &lt;span class="code-keyword"&gt;for&lt;/span&gt; display within a Tradestation workspace. After a LOT of time spent browsing around on various MicroSoft learning pages etc etc, I have arrived at the following method but cannot &lt;span class="code-keyword"&gt;get&lt;/span&gt; Visual Studio &lt;span class="code-digit"&gt;2022&lt;/span&gt; to load symbols or recognize the required .PDB file(s).

To complicate matters the DLL must be a release version and reside &lt;span class="code-keyword"&gt;in&lt;/span&gt; the Tradestation system file &lt;span class="code-keyword"&gt;for&lt;/span&gt; it to work with Tradestation.  It &lt;span class="code-keyword"&gt;is&lt;/span&gt; my understanding that &lt;span class="code-keyword"&gt;this&lt;/span&gt; &lt;span class="code-keyword"&gt;is&lt;/span&gt; ok so &lt;span class="code-keyword"&gt;long&lt;/span&gt; &lt;span class="code-keyword"&gt;as&lt;/span&gt; the relevent .pdb files are available to enable debugging.  Here &lt;span class="code-keyword"&gt;is&lt;/span&gt; my methodology so far:

&lt;span class="code-digit"&gt;1&lt;/span&gt;. Compile the C++ DLL &lt;span class="code-keyword"&gt;in&lt;/span&gt; Visual Studio &lt;span class="code-digit"&gt;2022&lt;/span&gt; &lt;span class="code-keyword"&gt;in&lt;/span&gt; RELEASE mode &lt;span class="code-keyword"&gt;as&lt;/span&gt; specified &lt;span class="code-keyword"&gt;for&lt;/span&gt; use &lt;span class="code-keyword"&gt;in&lt;/span&gt; tradestation.
&lt;span class="code-digit"&gt;2&lt;/span&gt;. Set post build to copy MyDLL.dll and MyDLL.pdb to C:\Program Files (x86)\TradeStation &lt;span class="code-digit"&gt;10&lt;/span&gt;.0\Program
&lt;span class="code-digit"&gt;3&lt;/span&gt;. Indicator &lt;span class="code-keyword"&gt;using&lt;/span&gt; function &lt;span class="code-sdkkeyword"&gt;from&lt;/span&gt; MyDLL.dll plots ok - great!
&lt;span class="code-digit"&gt;4&lt;/span&gt;. Set breakpoint &lt;span class="code-keyword"&gt;in&lt;/span&gt; C++ code within function &lt;span class="code-keyword"&gt;in&lt;/span&gt; Visual Studio &lt;span class="code-digit"&gt;2022&lt;/span&gt;: breakpoint shows no errors.
&lt;span class="code-digit"&gt;5&lt;/span&gt;. Attempt to debug &lt;span class="code-keyword"&gt;in&lt;/span&gt; release mode &lt;span class="code-keyword"&gt;in&lt;/span&gt; VS &lt;span class="code-digit"&gt;2022&lt;/span&gt; by attaching Tradestation process &lt;span class="code-keyword"&gt;using&lt;/span&gt; indicator/MyDLL to be debugged: Debug -&amp;gt; Attach to Process... -&amp;gt; ORPlat.exe

++++ Now things &lt;span class="code-keyword"&gt;do&lt;/span&gt; not go to plan ++++++++

&lt;span class="code-digit"&gt;6&lt;/span&gt;. MyDLL.dll not listed &lt;span class="code-keyword"&gt;in&lt;/span&gt; Modules window
&lt;span class="code-digit"&gt;7&lt;/span&gt;. Numerous messages appear &lt;span class="code-keyword"&gt;in&lt;/span&gt; the Modules window such &lt;span class="code-keyword"&gt;as&lt;/span&gt;:
ORPlat.exe C:\Program Files (x86)\TradeStation &lt;span class="code-digit"&gt;10&lt;/span&gt;.0\Program\ORPlat.exe Cannot find or open the PDB file.
&lt;span class="code-digit"&gt;8&lt;/span&gt;. MyDLL.dll shows up &lt;span class="code-keyword"&gt;as&lt;/span&gt; being loaded ok &lt;span class="code-keyword"&gt;using&lt;/span&gt; DebugView

Compiler settings &lt;span class="code-keyword"&gt;in&lt;/span&gt; VS2022 are:

/ifcOutput &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Release\" /GS /GL /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /Od /Fd"&lt;/span&gt;Release\vc143.pdb&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /Zc:inline /D "&lt;/span&gt;WIN32&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;NDEBUG&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;_WINDOWS&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;_USRDLL&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;GLOBALVARIABLE23_EXPORTS&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;_WINDLL&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;_UNICODE&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /D "&lt;/span&gt;UNICODE&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MT /FC /Fa"&lt;/span&gt;Release\&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /EHsc /nologo /Fo"&lt;/span&gt;Release\&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /Ot /Fp"&lt;/span&gt;Release\Future DLL.pch&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; /diagnostics:column 

Am I flogging a dead horse here? Is it impossible to debug MyDLL.dll from within Visual Studio by attaching it to the Tradestation process (ORPlat.exe)? If it is not possible (such as debugging only from within Tradestation; how do you attempt serious debugging in complex C++ code within your MyDLL.dll functions?

Any help on this greatly appreciated!

Cheers&lt;/span&gt;&lt;/pre&gt;</description>
      <author>PaulS_UK</author>
      <link>https://www.codeproject.com/Messages/6009148/Cplusplus-DLL-Debugging-Visual-Studio-2022</link>
      <pubDate>Tue, 09 Jul 2024 18:20:00 GMT</pubDate>
      <guid>3_6009148</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>TextBox File Open</title>
      <description>&lt;div class='pre-lang' id='premain283388'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode283388' class='copy-code' data-index='283388' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre283388' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-digit"&gt;0&lt;/span&gt;

I need to read the TextBox input, my username and password work &lt;span class="code-keyword"&gt;as&lt;/span&gt; below, but the file input and file output require another step to convert a &lt;span class="code-keyword"&gt;string&lt;/span&gt; that can open the files.

I&lt;span class="code-string"&gt;&amp;#39;&lt;/span&gt;&lt;span class="code-string"&gt;ve tried every example I can find, cstring numerous times.I can&amp;#39;&lt;/span&gt;t believe no one uses a textbox to open a file. Why can&lt;span class="code-string"&gt;&amp;#39;&lt;/span&gt;&lt;span class="code-string"&gt;t i get an answer? Will someone please read this question and answer it. I see that some questions get numerous answers and I can&amp;#39;&lt;/span&gt;t even &lt;span class="code-keyword"&gt;get&lt;/span&gt; one answer. Please help me!

THESE &lt;span class="code-digit"&gt;2&lt;/span&gt; BELOW WORK &lt;span class="code-keyword"&gt;private&lt;/span&gt;: System::Void usernameTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e) { msclr::interop::marshal_context context; std::&lt;span class="code-keyword"&gt;string&lt;/span&gt; myUsername = context.marshal_asstd::&lt;span class="code-keyword"&gt;string&lt;/span&gt;(usernameTextString); }

&lt;span class="code-keyword"&gt;private&lt;/span&gt;: System::Void passwordTextBox_TextChanged(System::Object^  sender, System::EventArgs^  e) {
     msclr::interop::marshal_context context;
     std::&lt;span class="code-keyword"&gt;string&lt;/span&gt; myPassword = context.marshal_as&amp;lt;std::string&amp;gt;(passwordTextString);
     }
THESE &lt;span class="code-digit"&gt;2&lt;/span&gt; BELOW NEED AN ADDITIONAL LINE OF CODE TO OPEN THE FILES &lt;span class="code-keyword"&gt;private&lt;/span&gt;: System::Void myInfileTextBox_TextChanged(System::Object^ sender, System::EventArgs^ e) { msclr::interop::marshal_context context; std::&lt;span class="code-keyword"&gt;string&lt;/span&gt; myInfile = context.marshal_asstd::&lt;span class="code-keyword"&gt;string&lt;/span&gt;(myInfileTextString); }

&lt;span class="code-keyword"&gt;private&lt;/span&gt;: System::Void myOutfileTextBox_TextChanged(System::Object^  sender, System::EventArgs^  e) {
     msclr::interop::marshal_context context;
     std::&lt;span class="code-keyword"&gt;string&lt;/span&gt; myOutfile = context.marshal_as&amp;lt;std::string&amp;gt;(myOutfileTextString);
     }&lt;/pre&gt;</description>
      <author>Robert Johnson 2023</author>
      <link>https://www.codeproject.com/Messages/6008928/TextBox-File-Open</link>
      <pubDate>Mon, 08 Jul 2024 07:42:00 GMT</pubDate>
      <guid>3_6008928</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>timer does not start</title>
      <description>Hi,&lt;br /&gt;
in my MFC DLL, pMyDLLCWnd is pointer to a class driver from CWnd.&lt;br /&gt;
When CDialog is linked to DLL, timer starts.&lt;br /&gt;
When console is linked to DLL, same timer does not start.&lt;br /&gt;
pMyDLLCWnd-&gt;Settimer(ID,t,NULL) &lt;br /&gt;
DLL has wm_timer message handler.</description>
      <author>etechX2</author>
      <link>https://www.codeproject.com/Messages/6007587/timer-does-not-start</link>
      <pubDate>Thu, 27 Jun 2024 06:20:00 GMT</pubDate>
      <guid>3_6007587</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>AfxRegisterWndClass crashes when called again</title>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
In my MFC project, I get crash as follows:&lt;br /&gt;
&lt;br /&gt;
1. i call MyCreate() then MyUnCreate()&lt;br /&gt;
2. calling MyCreate() the second time, causes crash at &lt;b&gt;AfxRegisterWndClass&lt;/b&gt; below.&lt;br /&gt;
&lt;br /&gt;
sudo code provided:&lt;br /&gt;
&lt;br /&gt;
CMyCwndSub is derived from CWnd.&lt;br /&gt;
&lt;br /&gt;
in another file:&lt;br /&gt;
&lt;br /&gt;
CMyCwndSub *p;&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain504390'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode504390' class='copy-code' data-index='504390' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre504390' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;void&lt;/span&gt; MyCreate()
{
    &lt;span class="code-comment"&gt;//in here code looks for Window with title "MyWndWin".
&lt;/span&gt;
	p-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-keyword"&gt;new&lt;/span&gt; CMyCwndSub;
	CString m = &lt;b&gt;AfxRegisterWndClass&lt;/b&gt;(&lt;span class="code-digit"&gt;0&lt;/span&gt;);       &lt;span class="code-comment"&gt;//crashes in this line the 2nd time called.
&lt;/span&gt;	p-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;CreateEx(&lt;span class="code-digit"&gt;0&lt;/span&gt;, m, -T&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;MyWndWin"&lt;/span&gt;,&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-digit"&gt;0&lt;/span&gt;,NULL,&lt;span class="code-digit"&gt;0&lt;/span&gt;);
	
	.
	.
	.
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain913884'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode913884' class='copy-code' data-index='913884' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre913884' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;void&lt;/span&gt; MyUnCreate()
{
&lt;span class="code-keyword"&gt;delete&lt;/span&gt; p;
p = NULL;
}&lt;/pre&gt;</description>
      <author>etechX2</author>
      <link>https://www.codeproject.com/Messages/6005412/AfxRegisterWndClass-crashes-when-called-again</link>
      <pubDate>Thu, 13 Jun 2024 06:07:00 GMT</pubDate>
      <guid>3_6005412</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>Inserting a user defined key in a C++ map</title>
      <description>Hi Guys,&lt;br /&gt;
&lt;br /&gt;
I have recently came across one scenario where I have to insert a user defined key in  a c++ map. that class looks like this&lt;br /&gt;
&lt;br /&gt;
class key&lt;br /&gt;
{&lt;br /&gt;
  int id;&lt;br /&gt;
  string name;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
map is like map&amp;lt;key,int&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I'll overload "operator&amp;lt;" function and will sort out based on "id" which will works fine, but the condition is like, if there are 2 entry with same ID but with a different name, for ex. {"50", Jack} and {"50", John}&lt;br /&gt;
&lt;br /&gt;
As both the values have SAME ID and different name, map should make an entry for both.&lt;br /&gt;
&lt;br /&gt;
Only in the case of combination of same ID and same name, it shouldn't allow the entry.&lt;br /&gt;
&lt;br /&gt;
bool operator&amp;lt;(key&amp;amp; temp)&lt;br /&gt;
  {&lt;br /&gt;
    if(id &amp;lt; temp.id)&lt;br /&gt;
    {&lt;br /&gt;
        return true;&lt;br /&gt;
    } &lt;br /&gt;
    if( id == temp.id)&lt;br /&gt;
        return name &amp;lt; temp.name;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
its not working properly, its overriding the last entry if same ID is there.&lt;br /&gt;
&lt;br /&gt;
Please help me out</description>
      <author>Amrit Agr</author>
      <link>https://www.codeproject.com/Messages/6005041/Inserting-a-user-defined-key-in-a-Cplusplus-map</link>
      <pubDate>Mon, 10 Jun 2024 18:23:00 GMT</pubDate>
      <guid>3_6005041</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>C++, epiphanies, article content ideas</title>
      <description>Disclaimer: What I'm about to talk about is C++ implementation details. C++ compilers aren't *necessarily* implemented the way I describe in theory, but in practice they virtually all are - at least the major ones, AFAIK.&lt;br /&gt;
&lt;br /&gt;
C++ is very "lexical" in how it works.&lt;br /&gt;
&lt;br /&gt;
The bones of the OOP, method overloading, and template instantiations are implemented in part through name mangling, which is fundamentally lexical vs having a different, say, integer or binary key for each of the above.&lt;br /&gt;
&lt;br /&gt;
The template instantiations work like a mail merge, but with "smart" template parameters (by smart I mean, not simply lexical but type aware, compiler resolved). The actual template code is basically search and replaced, but template resolution is "smart" (similar to how i used the word above) in that it can resolve recursively and stuff, so it's a bit more complicated than strict search replace, but it's close.&lt;br /&gt;
&lt;br /&gt;
C++ in many ways (but not all ways) is C with syntactic sugar.&lt;br /&gt;
&lt;br /&gt;
C++ OOP isn't special. It's basically C with a combination of name mangling, and hiding the first (implicit) &lt;code&gt;this&lt;/code&gt; argument&lt;br /&gt;
&lt;br /&gt;
consider the following&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain317756'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode317756' class='copy-code' data-index='317756' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre317756' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;#include&lt;/span&gt;&lt;span class="code-preprocessor"&gt; &lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-leadattribute"&gt;stdio.h&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;
&lt;span class="code-keyword"&gt;class&lt;/span&gt; foo {
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; m_bar;
public:
    foo(&lt;span class="code-comment"&gt;/*&lt;/span&gt;&lt;span class="code-comment"&gt;foo* this*/&lt;/span&gt;) : &lt;span class="code-comment"&gt;/*&lt;/span&gt;&lt;span class="code-comment"&gt;this-&amp;gt;*/&lt;/span&gt;m_bar(&lt;span class="code-digit"&gt;0&lt;/span&gt;) {

    }
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; bar(&lt;span class="code-comment"&gt;/*&lt;/span&gt;&lt;span class="code-comment"&gt;foo* this*/&lt;/span&gt;) &lt;span class="code-keyword"&gt;const&lt;/span&gt; { &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-keyword"&gt;this&lt;/span&gt;-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;m_bar; }
    &lt;span class="code-keyword"&gt;void&lt;/span&gt; bar(&lt;span class="code-comment"&gt;/*&lt;/span&gt;&lt;span class="code-comment"&gt;foo* this, */&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; &lt;span class="code-keyword"&gt;value&lt;/span&gt;) { &lt;span class="code-keyword"&gt;this&lt;/span&gt;-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;m_bar = &lt;span class="code-keyword"&gt;value&lt;/span&gt;; }
};

&lt;span class="code-keyword"&gt;typedef&lt;/span&gt; &lt;span class="code-keyword"&gt;struct&lt;/span&gt; _foo_c {
    &lt;span class="code-keyword"&gt;int&lt;/span&gt; bar;
} foo_c_t;

&lt;span class="code-keyword"&gt;void&lt;/span&gt; foo_foo_foo_c_t(foo_c_t* handle) {
    &lt;span class="code-comment"&gt;// : m_bar(0)
&lt;/span&gt;    handle-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;bar = &lt;span class="code-digit"&gt;0&lt;/span&gt;;
}
&lt;span class="code-keyword"&gt;int&lt;/span&gt; foo_bar_foo_c_t(foo_c_t* handle) {
    &lt;span class="code-comment"&gt;// return this-&amp;gt;bar;
&lt;/span&gt;    &lt;span class="code-keyword"&gt;return&lt;/span&gt; handle-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;bar;
}
&lt;span class="code-keyword"&gt;void&lt;/span&gt; foo_bar_foo_c_t_int(foo_c_t* handle, &lt;span class="code-keyword"&gt;int&lt;/span&gt; &lt;span class="code-keyword"&gt;value&lt;/span&gt;) {
    &lt;span class="code-comment"&gt;// this-&amp;gt;bar = value;
&lt;/span&gt;    handle-&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;bar = &lt;span class="code-keyword"&gt;value&lt;/span&gt;;
}

&lt;span class="code-keyword"&gt;int&lt;/span&gt; main(&lt;span class="code-keyword"&gt;int&lt;/span&gt; argc, &lt;span class="code-keyword"&gt;char&lt;/span&gt;** argv) {
    foo foo_cpp;
    foo_cpp.bar(&lt;span class="code-digit"&gt;42&lt;/span&gt;);

    foo_c_t foo_c;
    foo_foo_foo_c_t(&amp;amp;foo_c);
    foo_bar_foo_c_t_int(&amp;amp;foo_c,&lt;span class="code-digit"&gt;42&lt;/span&gt;);

    printf(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;foo_cpp: %d, foo_c: %d\n"&lt;/span&gt;,foo_cpp.bar(),foo_bar_foo_c_t(&amp;amp;foo_c));

    &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-digit"&gt;0&lt;/span&gt;;
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
That's C++ and its rough equivalent as C code, and the C is similar to how the C++ resolves internally.&lt;br /&gt;
&lt;br /&gt;
I feel like understanding that helped me greatly understand C++.&lt;br /&gt;
&lt;br /&gt;
I'm wondering if any other C++ developers out there had a similar epiphany about the language that helped them understand it better, and what it was.&lt;br /&gt;
&lt;br /&gt;
Part of it is I was thinking of compiling an article about this, but the above isn't enough by itself.&lt;br /&gt;
&lt;br /&gt;
I'm hoping to add more content, but maybe some of you who have had similar epiphanies about the language could inspire more content along this vein. If so, please put it in a reply. Thanks!&lt;br /&gt;
&lt;div class="signature"&gt;Check out my IoT graphics library here:&lt;br /&gt;
https://honeythecodewitch.com/gfx&lt;br /&gt;
And my IoT UI/User Experience library here:&lt;br /&gt;
https://honeythecodewitch.com/uix&lt;/div&gt;</description>
      <author>honey the codewitch</author>
      <link>https://www.codeproject.com/Messages/6004792/Cplusplus-epiphanies-article-content-ideas</link>
      <pubDate>Sat, 08 Jun 2024 06:28:00 GMT</pubDate>
      <guid>3_6004792</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>I never fail to be impressed by this</title>
      <description>Disclaimer: The following is intended to run in embedded environments that may not have a compliant STL if they have the STL at all. Some of this code could be replaced on systems with The STL to use std:: functionality.&lt;br /&gt;
&lt;br /&gt;
Anyway, it's code I wrote, but it's not my code that really impresses me about this, but rather the C++ compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain658600'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode658600' class='copy-code' data-index='658600' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre658600' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(pixel_type::template equals&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;gfx::rgb_pixel&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-digit"&gt;16&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;::value,
                          &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;this code needs to be ported for your display format"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
That's a compile time check to determine if a pixel format is exactly the same as the specified pixel format.&lt;br /&gt;
&lt;br /&gt;
Not impressed yet?&lt;br /&gt;
&lt;br /&gt;
Those pixel formats are arbitrarily defined:&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain749137'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode749137' class='copy-code' data-index='749137' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre749137' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-comment"&gt;// creates an RGB pixel by making each channel 
&lt;/span&gt;&lt;span class="code-comment"&gt;// one third of the whole. Any remainder bits
&lt;/span&gt;&lt;span class="code-comment"&gt;// are added to the green channel
&lt;/span&gt;&lt;span class="code-keyword"&gt;template&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; rgb_pixel = pixel&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::R,(BitDepth/3)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::G,((BitDepth/3)+(BitDepth%3))&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::B,(BitDepth/3)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
&lt;span class="code-comment"&gt;// creates an RGBA pixel by making each channel 
&lt;/span&gt;&lt;span class="code-comment"&gt;// one quarter of the whole. Any remainder bits
&lt;/span&gt;&lt;span class="code-comment"&gt;// are added to the green channel
&lt;/span&gt;&lt;span class="code-keyword"&gt;template&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; rgba_pixel = pixel&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::R,(BitDepth/4)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::G,((BitDepth/4)+(BitDepth%4))&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::B,(BitDepth/4)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::A,(BitDepth/4),&lt;span class="code-digit"&gt;0&lt;/span&gt;,(&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;(BitDepth/4))-&lt;span class="code-digit"&gt;1&lt;/span&gt;,(&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;(BitDepth/4))-&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
&lt;span class="code-comment"&gt;// creates a grayscale or monochome pixel
&lt;/span&gt;&lt;span class="code-keyword"&gt;template&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; gsc_pixel = pixel&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::L,BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
&lt;span class="code-comment"&gt;// creates a Y&amp;#39;UV pixel by making each channel 
&lt;/span&gt;&lt;span class="code-comment"&gt;// one third of the whole. Any remainder bits
&lt;/span&gt;&lt;span class="code-comment"&gt;// are added to the Y&amp;#39; channel
&lt;/span&gt;&lt;span class="code-keyword"&gt;template&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;using&lt;/span&gt; yuv_pixel = pixel&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::Y,((BitDepth/3)+(BitDepth%3))&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::U,(BitDepth/3)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;,
    channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;channel_name::V,(BitDepth/3)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
And furthermore&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain453571'&gt;&lt;div&gt;C++&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode453571' class='copy-code' data-index='453571' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre453571' style='margin-top:0;' class='lang-cplusplus' data-language='C++' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-comment"&gt;// defines a channel for a pixel
&lt;/span&gt;&lt;span class="code-keyword"&gt;template&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;
    &lt;span class="code-comment"&gt;// the channel name, like channel_name::R
&lt;/span&gt;    &lt;span class="code-keyword"&gt;typename&lt;/span&gt; Name,
    &lt;span class="code-comment"&gt;// the bit depth
&lt;/span&gt;    &lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; BitDepth, 
    &lt;span class="code-comment"&gt;// the minimum value
&lt;/span&gt;    bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt; Min=&lt;span class="code-digit"&gt;0&lt;/span&gt;, 
    &lt;span class="code-comment"&gt;// the maximum value
&lt;/span&gt;&lt;span class="code-preprocessor"&gt;#if HTCW_MAX_WORD &amp;gt;= 64
&lt;/span&gt;    bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt; Max= ((BitDepth==&lt;span class="code-digit"&gt;64&lt;/span&gt;)?0xFFFFFFFFFFFFFFFF:((&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;BitDepth)-&lt;span class="code-digit"&gt;1&lt;/span&gt;)), 
&lt;span class="code-preprocessor"&gt;#else
&lt;/span&gt;    bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt; Max= ((BitDepth==&lt;span class="code-digit"&gt;32&lt;/span&gt;)?0xFFFFFFFF:((&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;BitDepth)-&lt;span class="code-digit"&gt;1&lt;/span&gt;)), 
&lt;span class="code-preprocessor"&gt;#endif
&lt;/span&gt;    &lt;span class="code-comment"&gt;// the default value
&lt;/span&gt;    bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt; Default = Min,
    &lt;span class="code-comment"&gt;// the scale denominator
&lt;/span&gt;    bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt; Scale = Max
&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="code-keyword"&gt;struct&lt;/span&gt; channel_traits {
    &lt;span class="code-comment"&gt;// this type
&lt;/span&gt;    &lt;span class="code-keyword"&gt;using&lt;/span&gt; type = channel_traits&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;Name,BitDepth,Min,Max,Scale&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
    &lt;span class="code-comment"&gt;// the type that represents the name
&lt;/span&gt;    &lt;span class="code-keyword"&gt;using&lt;/span&gt; name_type = Name;
    &lt;span class="code-comment"&gt;// the integer type of this channel
&lt;/span&gt;    &lt;span class="code-keyword"&gt;using&lt;/span&gt; int_type = bits::uintx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;bits::get_word_size(BitDepth)&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
    &lt;span class="code-comment"&gt;// the floating point type of this channel
&lt;/span&gt;    &lt;span class="code-keyword"&gt;using&lt;/span&gt; real_type = bits::realx&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-digit"&gt;16&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=BitDepth?HTCW_MAX_WORD:32&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;;
    &lt;span class="code-comment"&gt;// the bit depth of this channel
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; &lt;span class="code-sdkkeyword"&gt;size_t&lt;/span&gt; bit_depth = BitDepth;
    &lt;span class="code-comment"&gt;// the minimum value
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type min = Min;
    &lt;span class="code-comment"&gt;// the maximum value
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type max = Max;
    &lt;span class="code-comment"&gt;// the default value
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type default_ = Default;
    &lt;span class="code-comment"&gt;// the scale denominator
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type scale = Scale;
    &lt;span class="code-comment"&gt;// the reciprocal of the scale denominator
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; real_type scaler = 1/(real_type)Scale; 
    &lt;span class="code-comment"&gt;// a mask of the int value
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type int_mask = ~int_type(&lt;span class="code-digit"&gt;0&lt;/span&gt;);
    &lt;span class="code-comment"&gt;// a mask of the channel value
&lt;/span&gt;    &lt;span class="code-keyword"&gt;constexpr&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;const&lt;/span&gt; int_type mask = bits::mask&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;::right;
    &lt;span class="code-comment"&gt;// constraints
&lt;/span&gt;    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(BitDepth&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Bit depth must be greater than 0"&lt;/span&gt;);
    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(BitDepth&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=&lt;span class="code-digit"&gt;64&lt;/span&gt;,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Bit depth must be less than or equal to 64"&lt;/span&gt;);
    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Min&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=Max,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Min must be less than or equal to Max"&lt;/span&gt;);
    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Default&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;=Min,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Default must be greater than or equal to the minimum value"&lt;/span&gt;);
    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Default&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=Max,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Default must be less than or equal to the maximum value"&lt;/span&gt;);
&lt;span class="code-preprocessor"&gt;#if HTCW_MAX_WORD &amp;gt;= 64        
&lt;/span&gt;    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Max&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=((BitDepth==&lt;span class="code-digit"&gt;64&lt;/span&gt;)?0xFFFFFFFFFFFFFFFF:((&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;BitDepth)-&lt;span class="code-digit"&gt;1&lt;/span&gt;)),&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Max is greater than the maximum allowable value"&lt;/span&gt;);
&lt;span class="code-preprocessor"&gt;#else
&lt;/span&gt;    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Max&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;=((BitDepth==&lt;span class="code-digit"&gt;32&lt;/span&gt;)?0xFFFFFFFF:((&lt;span class="code-digit"&gt;1&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code-keyword"&gt;&amp;lt;&lt;/span&gt;BitDepth)-&lt;span class="code-digit"&gt;1&lt;/span&gt;)),&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Max is greater than the maximum allowable value"&lt;/span&gt;);
&lt;span class="code-preprocessor"&gt;#endif
&lt;/span&gt;    &lt;span class="code-keyword"&gt;static_assert&lt;/span&gt;(Scale&lt;span class="code-keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code-digit"&gt;0&lt;/span&gt;,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Scale must not be zero"&lt;/span&gt;);
};&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I don't know of any other language that allows this kind of compile time expressiveness. I wish they did. Sometimes it feels like I'm "in dialogue" with the compiler rather than with the generated/runtime code as with most languages.&lt;br /&gt;
&lt;div class="signature"&gt;Check out my IoT graphics library here:&lt;br /&gt;
https://honeythecodewitch.com/gfx&lt;br /&gt;
And my IoT UI/User Experience library here:&lt;br /&gt;
https://honeythecodewitch.com/uix&lt;/div&gt;</description>
      <author>honey the codewitch</author>
      <link>https://www.codeproject.com/Messages/6004723/I-never-fail-to-be-impressed-by-this</link>
      <pubDate>Fri, 07 Jun 2024 15:44:00 GMT</pubDate>
      <guid>3_6004723</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>Passing a class (pointer)  to library - Linux</title>
      <description>I have one more question.&lt;br /&gt;
I will try my best to describe the issue and hoping the discussion does not get centered on terminology and RTFM as in the past. &lt;br /&gt;
That is not an instruction on how to reply, just a polite request to get real and skip opinions.&lt;br /&gt;
&lt;br /&gt;
( And if you think me saying this is rude...&lt;br /&gt;
I am just trying to get of the dime and writing it as politely as I  know) &lt;br /&gt;
&lt;br /&gt;
I did have resolved the syntax of "passing the class" , however now I am stuck with WHERE the class should be declared.&lt;br /&gt;
In layman terms - the calling object passes a class pointer to the function, which happens to be my own created library. I expect the library function to PROCESS the passed class...&lt;br /&gt;
And that is where I am not sure if I have to define / declare the SAME class again  - this time in the library.&lt;br /&gt;
I did test this using / passing SINGLE variable pointer and it worked OK.&lt;br /&gt;
&lt;br /&gt;
I am not sure what to do when the entire class is passed.&lt;br /&gt;
I do not think dupicating the class definition is vise. &lt;br /&gt;
&lt;br /&gt;
(Maybe it needs to be declared as global to the project ?)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any theoretical help , answer, would be appreciated, I can manage the code...&lt;br /&gt;
&lt;br /&gt;
Cheers &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain125139'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode125139' class='copy-code' data-index='125139' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre125139' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
&lt;span class="code-keyword"&gt;class&lt;/span&gt; BT_UTILITY_LIBRARY_EXPORT BT_Utility_Library
{
&lt;span class="code-keyword"&gt;public&lt;/span&gt;:
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; class variable&lt;/span&gt;
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; forward declaration ? works here !&lt;/span&gt;
    &lt;span class="code-keyword"&gt;class&lt;/span&gt; Test;

    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;May31&lt;/span&gt;
    QString DEBUG_Process(&lt;span class="code-keyword"&gt;void&lt;/span&gt;);
    QString DEBUG_Process(&lt;span class="code-keyword"&gt;int&lt;/span&gt; *);
    QString DEBUG_Process(&lt;span class="code-keyword"&gt;class&lt;/span&gt; Test *);
    QString DEBUG_Process_Class(&lt;span class="code-keyword"&gt;class&lt;/span&gt; Test *);

    QString REG_EXP_Process(&lt;span class="code-keyword"&gt;void&lt;/span&gt;);

    &lt;span class="code-keyword"&gt;class&lt;/span&gt; Test
    {
       &lt;span class="code-keyword"&gt;public&lt;/span&gt;:
       &lt;span class="code-keyword"&gt;int&lt;/span&gt; a;
       &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;int b[a];&lt;/span&gt;
       QString text;
    }TestPointer;&lt;/pre&gt;</description>
      <author>Salvatore Terress</author>
      <link>https://www.codeproject.com/Messages/6003591/Passing-a-class-pointer-to-library-Linux</link>
      <pubDate>Fri, 31 May 2024 19:00:00 GMT</pubDate>
      <guid>3_6003591</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>How  C++ manage memory in event driven system ?</title>
      <description>I am trying to improve my C++ skills and  could use some advice.&lt;br /&gt;
I am using event driven tool - I am not allowed to say the name here - &lt;br /&gt;
and my basic question is &lt;br /&gt;
if I create an instance of a class which uses a library&lt;br /&gt;
should the library by instantiated in class constructor &lt;br /&gt;
as a common to all class methods variable &lt;br /&gt;
or&lt;br /&gt;
be instantiated in each method ( as a local method variable ) as needed ?&lt;br /&gt;
Process speed is immaterial, my question is about how is &lt;br /&gt;
memory allocated / de-allocated ( managed by C++) during the events.</description>
      <author>Salvatore Terress</author>
      <link>https://www.codeproject.com/Messages/6003355/How-Cplusplus-manage-memory-in-event-driven-system</link>
      <pubDate>Thu, 30 May 2024 14:44:00 GMT</pubDate>
      <guid>3_6003355</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>UPDATE CLOSED  error: declaration of anonymous class must be a definition</title>
      <description>This post original subject - error: declaration of anonymous class must be a definition&lt;br /&gt;
was caused by this class &lt;b&gt;declaration&lt;/b&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class='pre-lang' id='premain339481'&gt;&lt;div&gt;&lt;/div&gt;&lt;div class='pre-action-link'&gt;&lt;span id='copycode339481' class='copy-code' data-index='339481' style='visibility:hidden'&gt;&lt;svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' viewBox='0 0 460 460' style='width: 16px;height:16px;' xml:space='preserve'&gt;&lt;g&gt;&lt;path d='M425.934,0H171.662c-18.122,0-32.864,14.743-32.864,32.864v77.134h30V32.864c0-1.579,1.285-2.864,2.864-2.864h254.272     c1.579,0,2.864,1.285,2.864,2.864v254.272c0,1.58-1.285,2.865-2.864,2.865h-74.729v30h74.729 c18.121,0,32.864-14.743,32.864-32.865V32.864C458.797,14.743,444.055,0,425.934,0z'&gt;&lt;/path&gt;&lt;path d='M288.339,139.998H34.068c-18.122,0-32.865,14.743-32.865,32.865v254.272C1.204,445.257,15.946,460,34.068,460h254.272 c18.122,0,32.865-14.743,32.865-32.864V172.863C321.206,154.741,306.461,139.998,288.339,139.998z M288.341,430H34.068    c-1.58,0-2.865-1.285-2.865-2.864V172.863c0-1.58,1.285-2.865,2.865-2.865h254.272c1.58,0,2.865,1.285,2.865,2.865v254.273h0.001 C291.206,428.715,289.92,430,288.341,430z'&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;pre id='pre339481' style='margin-top:0;' data-allowShrink='True' data-collapse='False'&gt;
&amp;lt;   &lt;span class="code-keyword"&gt;class&lt;/span&gt; REG_EXP                         &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;regular_expression_class&lt;/span&gt;
    {
        &lt;span class="code-keyword"&gt;int&lt;/span&gt; a;
        QString text;
        QString RegExp;
        QString Analyze;
    } TEST_REG_EXP;
/pre&amp;gt;

Search &lt;span class="code-keyword"&gt;for&lt;/span&gt; the symbol &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;REG_EXP"&lt;/span&gt; &lt;span class="code-keyword"&gt;in&lt;/span&gt; the entire project returned no result. 
The conclusion 
it &lt;span class="code-keyword"&gt;is&lt;/span&gt; unknown why the error was posted.
Please consider &lt;span class="code-keyword"&gt;this&lt;/span&gt; matter closed.&lt;/pre&gt;</description>
      <author>Salvatore Terress</author>
      <link>https://www.codeproject.com/Messages/6002651/UPDATE-CLOSED-error-declaration-of-anonymous-class</link>
      <pubDate>Sat, 25 May 2024 15:49:00 GMT</pubDate>
      <guid>3_6002651</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>UPDATE REPOST BUMP  How to construct / build / interpret regular expression ?</title>
      <description>UPDATE &lt;br /&gt;
DONE &lt;br /&gt;
"Match any number  of characters , (from start of the line) , until "new line \n " is reached :&lt;br /&gt;
&lt;br /&gt;
QRegularExpression re( ".*\n");&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
match first  word only (of each line ) &lt;br /&gt;
match the entire text  (first word of each line ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I am VERY sorry to be such bother, but I am actually looking &lt;br /&gt;
for someone / somebody &lt;b&gt;willing to help me&lt;/b&gt; to interpret ( read) the Linux &lt;br /&gt;
regular expression manual to build the expression.&lt;br /&gt;
&lt;br /&gt;
My task is to &lt;br /&gt;
match each and every FIRST word in multi-line string .&lt;br /&gt;
&lt;br /&gt;
I am stuck at &lt;br /&gt;
&lt;br /&gt;
"\w+" &lt;br /&gt;
&lt;br /&gt;
which &lt;b&gt;matches EVERY word in the entire text&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I can post my current code when I get &lt;br /&gt;
"I am willing  help you..." &lt;br /&gt;
response&lt;br /&gt;
&lt;br /&gt;
Thank you very much for understanding . &lt;br /&gt;
&lt;br /&gt;
Sal</description>
      <author>Salvatore Terress</author>
      <link>https://www.codeproject.com/Messages/6002558/UPDATE-REPOST-BUMP-How-to-construct-build-interpre</link>
      <pubDate>Fri, 24 May 2024 16:31:00 GMT</pubDate>
      <guid>3_6002558</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>Okay, real C++ question - who makes use of the auto keyword?</title>
      <description>I'm trying to straighten out some pointer "arithmetic" in some existing code.  The expressions themselves are overly ambiguous to say the least.  In part of my readings, I've come across the "auto" keyword where the compiler deduces what type I need.  At least that's what I got from all of the verbiage. &lt;br /&gt;
&lt;br /&gt;
This seems a) dangerous and b) adds another level of mental indirection to what you are trying to accomplish. To me, software needs to be very clear and explicit in what data you are working with and what you intend to do with it.  A lot of the "here is how auto will help you" descriptions justify it by saving typing when trying to make use of other classes, templates and the like.  It feels like the C++ committee came up with a feature A then added feature B to make using A easier.  I'm now doing battle with lambda expressions - another story.&lt;br /&gt;
&lt;br /&gt;
So, in your code - do you make extensive use of auto, and how does it help you?&lt;br /&gt;
&lt;div class="signature"&gt;Charlie Gilley&lt;br /&gt;
&lt;br /&gt;
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.”  BF, 1759&lt;br /&gt;
&lt;br /&gt;
Has never been more appropriate.&lt;/div&gt;</description>
      <author>charlieg</author>
      <link>https://www.codeproject.com/Messages/6001776/Okay-real-Cplusplus-question-who-makes-use-of-the</link>
      <pubDate>Sun, 19 May 2024 11:29:00 GMT</pubDate>
      <guid>3_6001776</guid>
      <subject>C / C++ / MFC</subject>
    </item>
    <item>
      <title>mfc, vs2022 compatible?</title>
      <description>Maybe someone can point me to a reference or provide direct experience.  I'm trying to lift a VC6++ application to VS2022.  Originally targeted at Xp, this will need to run under Win10 and 11.  So, I thought it would also be a good idea to get it into a modern development environment.&lt;br /&gt;
&lt;br /&gt;
Well, the # of warnings I am suppressing is getting concerning, but I understand what the warnings are about.  Then I ran into this line of code:&lt;br /&gt;
&lt;br /&gt;
"ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)"&lt;br /&gt;
&lt;br /&gt;
pure mfc macro which generates "....cpp(66): warning C26454: Arithmetic overflow: '-' operation produces a negative unsigned result at compile time (io.5)."&lt;br /&gt;
&lt;br /&gt;
Mousing over the macro, it expands to some hideous expression: "{ 0x004E + 0xBC00, (WORD)(int)((0U - 0U) - 12), 0, 0, AfxSigNotify_v, (AFX_PMSG)(static_cast&amp;lt;void (ccmdtarget::*)(nmhdr*,="" lresult*)=""&amp;gt; (OnCustomDraw)) },"&lt;br /&gt;
&lt;br /&gt;
It's clear why the compiler is alarmed: "(WORD)(int)((0U - 0U) - 12)"&lt;br /&gt;
&lt;br /&gt;
Am I just wasting my time here?  I'm going to thunder on, but I'm starting to wonder if I'm going to run into so much nonsense like this that it calls into question if I'll have anything working at the end....&lt;br /&gt;
&lt;div class="signature"&gt;Charlie Gilley&lt;br /&gt;
&lt;br /&gt;
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.”  BF, 1759&lt;br /&gt;
&lt;br /&gt;
Has never been more appropriate.&lt;/div&gt;</description>
      <author>charlieg</author>
      <link>https://www.codeproject.com/Messages/6001638/mfc-vs2022-compatible</link>
      <pubDate>Fri, 17 May 2024 17:21:00 GMT</pubDate>
      <guid>3_6001638</guid>
      <subject>C / C++ / MFC</subject>
    </item>
  </channel>
</rss>