Advertisement

asBEHAVE_ASSIGN doesn't work with void return

Started by November 01, 2007 10:05 AM
1 comment, last by Gyrbo 17 years, 1 month ago
The following code causes an error:
// ERROR! r = -10 (INVALID_DECLARATION)
r = engine->RegisterObjectBehaviour("Test", asBEHAVE_ASSIGNMENT, "void f(const Test &in)", asMETHOD(Test, operator=), asCALL_THISCALL);
// This works
//r = engine->RegisterObjectBehaviour("Test", asBEHAVE_ASSIGNMENT, "Test& f(const Test &in)", asMETHOD(Test, operator=), asCALL_THISCALL);

Is there any specific reason this is disallowed, or is this a bug?
It's more for not opening up features before they have been thoroughly thought through, so that I won't have to remove them afterwards. Allowing other return types than the reference of the type, opens up more paths that need to be tested and I haven't had the time to analyse the true impacts of that yet.

Do you have any specific needs for not returning the reference of the object after an assignment?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
I don't have a particular reason for it. The reason I asked it is that for some reason TinyXML (which I'm trying to bind with my auto-binder) has it this way.

Since I'm generating wrapper functions anyway, it's easy to provide an AS compatible signature. I was just wondering why it was this way, no need to consider this a feature request :). It may be useful to mention it in the documentation, though.

This topic is closed to new replies.

Advertisement