Arrays of GvNode pointers
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/08/2006 at 12:21, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.521
Platform: Windows ;
Language(s) : C++ ;---------
Hi Guys,
This is more of a C++ related question, than that of a Cinema SDK question. But, I need to create an array of GvNode pointers. So my code is the following:
const LONG arraySize = 1000;
GvNode *pNode[arraySize] = NULL;
Now when ever I go to compile this I get the following error:
'cannot convert from 'int' to 'GvNode *[1000]'
I would think that this would create an array of 1000 GvNode *pNode. But obviously this isn't the case. Anyone have any ideas how to make this array of pointers work?
PS; I have checked all my C++ programming books to make sure that my syntax for creating arrays of pointers is correct, which it is os I am a little confused on why the compiler is flagging this error. As always thanks for any help.
Josh -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/08/2006 at 15:29, xxxxxxxx wrote:
I don't think that it is legal to set an array to NULL (?). You could always try:
GvNode* pNode[arraySize] = static_cast<GvNode*[arraySize]>(NULL);
Personally, that's just too much obfuscation even if it works. This is the better approach:
const LONG arraySize = 1000;
GvNode* pNode[arraySize];
//** this **
for (LONG e = 0; e < arraySize; ++e) pNode[e] = NULL;
//** or this **
ClearMem(&pNode;[0], sizeof(GvNode* )*arraySize);