THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/03/2004 at 08:06, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.500
Platform: Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Howdy,
There seems to be a problem with the c4d_memory.h file and compiling with Codewarrior v9 for Mac (OSX and Classic).
The two problem lines are:
void operator delete(void *p);
void operator delete[](void *p);
If these line are commented out, along with the coresponding calls from c4d_memory.cpp:
void operator delete(void *p)
{
if (p)
{
void *temp=p;
C4DOS.Ge->Free(temp);
}
}
void operator delete[](void *p)
{
if (p)
{
void *temp=p;
C4DOS.Ge->Free(temp);
}
}
...then the SDK will compile, but Cinema 4D will crash if you try to delete a "C++SDK-Look at Camera Expression" tag, so these two lines are very important.
The compiler error is "exception specification list mismatch" and it says this in the CW reference:
C/C++ Error 10265
exception specification list mismatch
The exception specification lists for a function declaration and a function definition do not match.
void f() throw(int);
// exception specification list mismatch
void f() throw(long) {}
Fix
Use a matching exception specification.
void f() throw(int);
void f() throw(int) {}
When I looked up "operator delete" and "operator delete[] in the CW reference, it says this:
Operator delete frees memory allocated with operator new.
void operator delete(void* ptr) throw();
void operator delete(void* ptr, const std::nothrow_t&) throw();
Operator delete[] is used in conjunction with operator new[] for array allocations.
void operator delete[](void* ptr) throw();
void operator delete[](void* ptr, const std::nothrow_t&) throw();
The only difference between the SDK and the example in the CW reference is the "throw()" at the end of the line. If I add this to the two lines in the c4d_memory.h and c4d_memory.cpp then the SDK will compile but I get two warnings:
deleting a void pointer is undefined (delete p;) and it points to these lines from c4d_memory.cpp:
// for STL
void operator delete(void *p, int line,const CHAR *file)
{
delete p;
}
void operator delete[](void *p, int line,const CHAR *file)
{
delete[] p;
}
Is this going to cause problems? I'm not sure I understand the significance of the "throw()" that I added to the lines and will that also cause problems? The SDK plug in seems to be working in Cinema 4D and I can delete the "C++SDK-Look at Camera Expression" tag without crashing.
I'm a little reluctant to proceed. Any insights on this situation?
Adios,
Cactus Dan