Please enable JavaScript to view this site.

A-Shell Development History

Navigation: » No topics above this level «

DYNSTRUCT Assignment Refinement

Scroll Prev Top Next More

Assignments of the following format...

DS = ST

...where DS is a bound dynstruct variable and ST is an unformatted variable or structure, will now preserve the size of DS, regardless of the size of ST. In other words, it will treat DS as a fixed size target, but with the added feature of clearing any bytes in DS that are beyond the size of ST.

Previously, since DYNSTRUCT variables are dynamic, such an assignment would resize the DS target if it didn't match the size of ST. And that could lead to an invalid memory reference if the assignment caused the DYNSTRUCT to shrink and then you subsequently tried to reference a field in the structure that was now beyond the new size.

This is a rare and unusual situation, since the normal use case is to only assign dynstruct instances from structures that match the currently bound definition. But this change closes that loophole and also possibly opens up some advanced possibilites for handling structures that vary in length but are otherwise compatible.