Don't use Destroy as a method name unless it's a destructor.

Hello,

Don't use Destroy as a method name unless it's a destructor, this is not a destructor:

class b2ContactManager.void Destroy(b2Contact* c);

It leads to a weird situation in Delphi programming language.

The method name Destroy should only be used for destructors when used in classes.

Instead the method name should be renamed to:

DestroyContact

Bye,
Skybuck.
In C++ destructors are written like this

Code:
MyClass::~MyClass()
{
  // free stuff
}


So it is not possible for Destroy to be a destructor.

That said, feel free to modify Box2D to suit your purposes.
Erin Catto wrote:
In C++ destructors are written like this

Code:
MyClass::~MyClass()
{
// free stuff
}




I know that...

The destroy is just a method in your C++ class it's not a destructor.

But Delphi will complain... it will think it's a destructor because it's named Destroy which is reserved for destructors only.

So a rename to DestroyContact would be nice.

It's a little spot on your library... it's like having a nice shiny ferrari with a little mud spot on it ! 😉 =D

I'd feel more comfortable if you would adjust your library because you know what's going on 😉

It might also make sharing/translating code between delphi/c++ back and forth easier in the future 😉 🙂

A possibly way to do so could be:

Use DestroyContact inside your library everywhere.

Let Destroy exist but make it deprecated with/via a comment and make a note it's only for backwards compatibility with existing C++ user code.
Delphi translations should ignore Destroy and not use it at all/leave it out... and C++ code should start using DestroyContact.

Everybody happy ?! 😉 🙂

Bye,
Skybuck.

Original thread: https://box2d.org/forum/viewtopic.php?t=5430