AS 2.0 delayed - security risk with parameter references

Started by
9 comments, last by WitchLord 19 years, 4 months ago
I've been able to fix the security issue with the parameter references so now I'm back on the normal schedule.

What AngelScript now does is that it always passes a reference to a temporary variable instead of the real variable. The script language has also been modified so that parameter references must be marked with either in, out, or inout so that the compiler can avoid making unnecessary copies. For in parameters the argument expression is evaluated before the call. For out parameters the expression is evaluated after the call. For inout parameters the expression is evaluated both before and after the call. In this case the compiler gives a warning if the expression is complex, i.e. if it uses any function calls, incremental operators, etc.

I believe this is the best solution that I can make while allowing parameter references. Obviously there are no performance advantages of passing parameters by reference because of this, in fact it might even have a performance impact. In some cases it is justifiable though, for example when functions need to return more than one value.

With the introduction of object handles, these will be a better way of passing objects, as they will simply increase the reference count of the object instead of making a copy of them.

The way I solved the parameter references will also allow me to support property get/set functions which is something I've been asked for and that I believe is a good thing. With get/set functions it is possible to add automatic notifications when a property is altered or used.

Regards,
Andreas

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

This topic is closed to new replies.

Advertisement