2024-01-21 10:59 AM - last edited on 2024-09-09 11:26 AM by Doreena Deng
Static assertion failed due to requirement 'GS::IsVoid<API_ServerApplicationInfo> || GS::IsTriviallyCopyable<API_ServerApplicationInfo>': The parameter of BNZeroMemory should be trivially copyable.
Solved! Go to Solution.
2024-01-21 08:38 PM
Earlier every Archicad struct was a POD type, so it was safe - and actually recommended - to call 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.
The error you get means that you shouldn't call BNZeroMemory on the API_ServerApplicationInfo struct anymore. So you can safely skip the BNZeroMemory call since the constructor will do the initialization.
You may still want to call BNZeroMemory if you are targeting older Archicad versions, in this case this code will do the trick:
API_ServerApplicationInfo appInfo = {};
#ifndef ServerMainVers_2700
BNZeroMemory (&appInfo, sizeof (appInfo));
#endif
2024-01-21 08:38 PM
Earlier every Archicad struct was a POD type, so it was safe - and actually recommended - to call 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.
The error you get means that you shouldn't call BNZeroMemory on the API_ServerApplicationInfo struct anymore. So you can safely skip the BNZeroMemory call since the constructor will do the initialization.
You may still want to call BNZeroMemory if you are targeting older Archicad versions, in this case this code will do the trick:
API_ServerApplicationInfo appInfo = {};
#ifndef ServerMainVers_2700
BNZeroMemory (&appInfo, sizeof (appInfo));
#endif
2024-01-22 11:49 AM
Actually this code is redundant
#ifndef ServerMainVers_2700
BNZeroMemory (&appInfo, sizeof (appInfo));
#endif
I've been using initializer list instead of BNZeroMemory or templated BNClear and it works fine since AC24 (I haven't tried with AC23 and older versions). Also, since C++ 11 the equal sign is optional, i.e.
API_ServerApplicationInfo appInfo{};
is enough.