Supported platform: Windows and Mac OS
Supported release(s): AutoCAD 2025 and later
Changes made to the AcString class may require you to update your programs when using functions, such as printf and similar style of functions. Previously, AcString was just a pointer and could be passed by value to a variadic function.
To resolve this problem, in most cases you just need to use the constPtr() function of the AcString class. For example, the first code statement below shows the code statement that worked in earlier releases prior to AutoCAD 2025, while the second statement shows the use of the constPtr() function to resolve the problem.
// Problem statement acutPrintf(ACRX_T("\nBlock %s converted %d results"), blkName, it->second); // Updated statement acutPrintf(ACRX_T("\nBlock %s converted %d results"), blkName.constPtr(), it->second);
Compiler Errors
When compiling, you might see one or more of the following warnings if you need to address a problem related to the use of AcString:
- warning G319FBF53: Null pointer passed as 1st argument to string length function [clang-analyzer-unix.cstring.NullArg]
- warning GF6F05EF3: Called function pointer is null (null dereference) [clang-analyzer-core.CallAndMessage]
- warning GA42D982B: cannot pass object of non-trivial type 'AcString' through variadic function; call will abort at runtime [clang-diagnostic-non-pod-varargs]
- warning G6AFCE40B: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage]
- warning GEB493B52: no viable conversion from 'xxxx' to 'AcString' [clang-diagnostic-error]
- warning GEB493B52: no viable conversion from 'AcString' to 'xxxx' [clang-diagnostic-error]
- warning GC266E94E: non-const lvalue reference to type 'AcString' cannot bind to a temporary of type 'AcString' [clang-diagnostic-error]
- warning GD877B189: Array access (from variable 'xxx') results in a null pointer dereference [clang-analyzer-core.NullDereference]
- warning G6C202045: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]