<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic The parameter of BNZeroMemory should be trivially copyable in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/The-parameter-of-BNZeroMemory-should-be-trivially-copyable/m-p/615039#M9663</link>
    <description>&lt;P&gt;I've been trying to convert a AC26 add-on to AC27 and got this error message. It works well in AC26.&lt;/P&gt;
&lt;P&gt;Here's my code.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAFD_0-1720672187060.png" style="width: 804px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/65959i664AEDCCFC0BDA7B/image-dimensions/804x103?v=v2" width="804" height="103" role="button" title="RAFD_0-1720672187060.png" alt="RAFD_0-1720672187060.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2024 07:19:38 GMT</pubDate>
    <dc:creator>RAFD</dc:creator>
    <dc:date>2024-07-12T07:19:38Z</dc:date>
    <item>
      <title>The parameter of BNZeroMemory should be trivially copyable</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/The-parameter-of-BNZeroMemory-should-be-trivially-copyable/m-p/615039#M9663</link>
      <description>&lt;P&gt;I've been trying to convert a AC26 add-on to AC27 and got this error message. It works well in AC26.&lt;/P&gt;
&lt;P&gt;Here's my code.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RAFD_0-1720672187060.png" style="width: 804px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/65959i664AEDCCFC0BDA7B/image-dimensions/804x103?v=v2" width="804" height="103" role="button" title="RAFD_0-1720672187060.png" alt="RAFD_0-1720672187060.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 07:19:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/The-parameter-of-BNZeroMemory-should-be-trivially-copyable/m-p/615039#M9663</guid>
      <dc:creator>RAFD</dc:creator>
      <dc:date>2024-07-12T07:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: The parameter of BNZeroMemory should be trivially copyable</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/The-parameter-of-BNZeroMemory-should-be-trivially-copyable/m-p/615042#M9664</link>
      <description>&lt;P&gt;There is an article from earlier this year about it&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Graphisoft lia-component-message-view-widget-author-username"&gt; &lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" style="color: #011622;" href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/12765" target="_self" aria-label="View Profile of Viktor Kovacs"&gt;&lt;SPAN class=""&gt;Viktor Kovacs&lt;/SPAN&gt;&lt;/A&gt; from &lt;/SPAN&gt;Graphisoft explains the change here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-message-main"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-message-main-content"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;
&lt;DIV id="bodyDisplay_1" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;DIV class="lia-message-body-accepted-solution-checkmark"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;Earlier every Archicad struct was a POD type, so it was safe - and actually recommended - to call&amp;nbsp;BNZeroMemory on them to initialize the object. Since the API is getting more and more modern, now there are some non-POD objects where it is not safe to zero the memory since it will corrupt the data structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error you get means that you shouldn't call&amp;nbsp;BNZeroMemory on the&amp;nbsp;API_ServerApplicationInfo struct anymore. So you can safely skip the&amp;nbsp;BNZeroMemory call since the constructor will do the initialization.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may still want to call&amp;nbsp;BNZeroMemory if you are targeting older Archicad versions, in this case this code will do the trick:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-cpp"&gt;&lt;CODE&gt;API_ServerApplicationInfo appInfo = {};
#ifndef ServerMainVers_2700
    BNZeroMemory (&amp;amp;appInfo, sizeof (appInfo));
#endif&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.graphisoft.com/t5/Archicad-C-API/BNZeromemory-Error-in-Archicad-27/td-p/584809" target="_blank" rel="noopener"&gt;https://community.graphisoft.com/t5/Archicad-C-API/BNZeromemory-Error-in-Archicad-27/td-p/584809&lt;/A&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 04:56:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/The-parameter-of-BNZeroMemory-should-be-trivially-copyable/m-p/615042#M9664</guid>
      <dc:creator>AllanP</dc:creator>
      <dc:date>2024-07-11T04:56:16Z</dc:date>
    </item>
  </channel>
</rss>

