Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Problem with c4d_memory.h and CW 9

    SDK Help
    0
    2
    322
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 06/04/2004 at 02:24, xxxxxxxx wrote:

        You can safely edit the c4d_memory files in the API folder as the above (and the more recent post on the subject) indicate. As C4D doesn't use exceptions anywhere it shouldn't really matter, and the other point just means that CW has stricter language lawyers.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post