gpt4 book ai didi

c++ - char&* 是什么意思?

转载 作者:太空宇宙 更新时间:2023-11-04 14:55:26 25 4
gpt4 key购买 nike

摘自Autodesk公司AutoCAD 2013(ObjectARX SDK)官方文档:

ObjectARX for AutoCAD 2013: Readme -> Tips and Techniques -> Freeing *Strings Returned as Non-const Pointers:*

When calling methods that return non-const string pointers (for example, AcDbSymbolTable::getName(char&* pName)), you should free the memory occupied by the returned string. For example:

// The getName() call should be followed by a call to
acutDelString(pLtName);pLtTableRcd->getName(pLtName);
// ... other code
acutDelString(pLtName);

Note that some of the ObjectARX sample files are missing calls to free the memory, so they will exhibit memory leaks. When using the samples in your own code, make sure to free the memory properly.

下一个参数类型是什么意思:

AcDbSymbolTable::getName(char&* pName))

它是指向char&的指针吗?凭什么?什么时候使用这样的结构?

谢谢。

最佳答案

根据clockwise/spiral rule pName 是指向对 char 的引用的指针。

我会说拥有指向引用的指针没有多大意义。不过,另一种方法(拥有对指针的引用)可能很有用,因为您随后可以在函数内部更改指针。

关于c++ - char&* 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17483791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com